git-tracker: remove shortlog for empty changes
authorJohannes Berg <johannes.berg@intel.com>
Wed, 21 May 2014 07:44:43 +0000 (09:44 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 1 Jun 2014 22:16:15 +0000 (00:16 +0200)
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 <johannes.berg@intel.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
devel/git-tracker.py

index 01b1d6cce38a92089cccf92dec1cf46291bbcb62..2419490818ba6b0bfd8da6fee4b1a126df09d2ce 100755 (executable)
@@ -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,