From: Johannes Berg Date: Wed, 21 May 2014 07:44:43 +0000 (+0200) Subject: git-tracker: remove shortlog for empty changes X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=f8ef0108bcc9b685c3d489079325c56f77c49e09;p=openwrt%2Fstaging%2Fblogic.git git-tracker: remove shortlog for empty changes When the input tree had changes but the output doesn't get any changes at all, then the shortlog was being generated over all commits since no files were specified. Catch this special case and instead of generating a shortlog just add a note that no commits changed generated code. Signed-off-by: Johannes Berg Signed-off-by: Hauke Mehrtens --- diff --git a/devel/git-tracker.py b/devel/git-tracker.py index 01b1d6cce38a..2419490818ba 100755 --- a/devel/git-tracker.py +++ b/devel/git-tracker.py @@ -93,8 +93,12 @@ def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, ba files = [] for d in git.status(tree=wdir): files.extend(d[1:]) - msg += git.shortlog(append_shortlog[0], append_shortlog[1], - tree=kernelobjdir, files=files) + if files: + msg += '\n' + append_shortlog[2] + '\n\n' + msg += git.shortlog(append_shortlog[0], append_shortlog[1], + tree=kernelobjdir, files=files) + else: + msg += "\nNo commits changed the generated code.\n\n" msg += '''%(newline)s %(PREFIX)sbackport: %(bprev)s @@ -242,16 +246,16 @@ if __name__ == '__main__': try: # add information about commits that went into this git.rev_parse('%s^2' % commit, tree=kernelobjdir) - msg += "\nCommits in this merge:\n\n" - append_shortlog = (prev, '%s^2' % commit) + append_shortlog = (prev, '%s^2' % commit, + "Commits in this merge:") except git.ExecutionError as e: # will fail if it wasn't a merge commit pass else: # multiple commits env = backport_author_env - msg = "update multiple kernel commits\n\nCommits taken:\n\n" - append_shortlog = (prev, commit) + msg = "update multiple kernel commits\n" + append_shortlog = (prev, commit, "Commits taken:") failure = handle_commit(args, msg, branch, tree, kernelobjdir, branch_tmpdir, wgitdir, backport_rev, commit, env=env, prev_kernel_rev=prev, defconfig=defconfig,