git-map-branches: Fix --show-subject for branches that are gone

Without this change, the script would try to query the subject of
branches that no longer exist (these are shown as
`{branch-name:GONE}` in the output of the command).

Bug: None
Change-Id: Ia8dafe428654a1ab995dcd0be794e6fd9e25bc7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4078970
Commit-Queue: Christian Flach <cmfcmf@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
This commit is contained in:
Christian Flach
2022-12-07 09:00:42 +00:00
committed by LUCI CQ
parent 107142ac38
commit a2658217d2

View File

@@ -288,7 +288,7 @@ class BranchMapper(object):
# The subject of the most recent commit on the branch.
if self.show_subject:
if branch:
if not self.__is_invalid_parent(branch):
line.append(run('log', '-n1', '--format=%s', branch, '--'))
else:
line.append('')