git-map-branches: support no-parent when showing subjects
If one of the "branches" being shown by 'git map-branches' is
the pseudo-branch "{NO_UPSTREAM}", and the user has asked the
command to print the subject line of each branch, it would
crash. This change causes it to gracefully handle that case.
R=lgarron@chromium.org
Bug: 758428
Change-Id: Id0ff1c6fd90b5efbb07e118ae088e3999c234b67
Reviewed-on: https://chromium-review.googlesource.com/639190
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
diff --git a/git_map_branches.py b/git_map_branches.py
index 58bfb35..28586e1 100755
--- a/git_map_branches.py
+++ b/git_map_branches.py
@@ -269,7 +269,10 @@
# The subject of the most recent commit on the branch.
if self.show_subject:
- line.append(run('log', '-n1', '--format=%s', branch, '--'))
+ if branch:
+ line.append(run('log', '-n1', '--format=%s', branch, '--'))
+ else:
+ line.append('')
self.output.append(line)