mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Gerrit git cl: fix change-id appending.
Special case when the change description has no footers, but looks like a footer. R=machenbach@chromium.org,andybons@chromium.org BUG=579176 Review URL: https://codereview.chromium.org/1812803002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299343 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -83,9 +83,13 @@ def add_footer_change_id(message, change_id):
|
|||||||
if line == '' or line.isspace():
|
if line == '' or line.isspace():
|
||||||
break
|
break
|
||||||
footer_lines.append(line)
|
footer_lines.append(line)
|
||||||
|
else:
|
||||||
|
# The whole description was consisting of footers,
|
||||||
|
# which means those aren't footers.
|
||||||
|
footer_lines = []
|
||||||
# footers order is from end to start of the message.
|
# footers order is from end to start of the message.
|
||||||
footers = map(parse_footer, footer_lines)
|
footers = map(parse_footer, footer_lines)
|
||||||
if not all(footers):
|
if not footers or not all(footers):
|
||||||
lines.append('')
|
lines.append('')
|
||||||
lines.append(change_id_line)
|
lines.append(change_id_line)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -99,6 +99,11 @@ My commit message is my best friend. It is my life. I must master it.
|
|||||||
git_footers.add_footer_change_id('header\n\nBUG: yy\n\nPos: 1', 'Ixxx'),
|
git_footers.add_footer_change_id('header\n\nBUG: yy\n\nPos: 1', 'Ixxx'),
|
||||||
'header\n\nBUG: yy\n\nChange-Id: Ixxx\nPos: 1')
|
'header\n\nBUG: yy\n\nChange-Id: Ixxx\nPos: 1')
|
||||||
|
|
||||||
|
# Special case: first line is never a footer, even if it looks line one.
|
||||||
|
self.assertEqual(
|
||||||
|
git_footers.add_footer_change_id('header: like footer', 'Ixxx'),
|
||||||
|
'header: like footer\n\nChange-Id: Ixxx')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user