diff --git a/git_footers.py b/git_footers.py index 4277753b7..a41cdb59d 100755 --- a/git_footers.py +++ b/git_footers.py @@ -13,7 +13,7 @@ from collections import defaultdict import git_common as git -FOOTER_PATTERN = re.compile(r'^\s*([\w-]+): (.*)$') +FOOTER_PATTERN = re.compile(r'^\s*([\w-]+): *(.*)$') CHROME_COMMIT_POSITION_PATTERN = re.compile(r'^([\w/\-\.]+)@{#(\d+)}$') diff --git a/tests/git_footers_test.py b/tests/git_footers_test.py index 519f42f6c..1ae6dd185 100755 --- a/tests/git_footers_test.py +++ b/tests/git_footers_test.py @@ -35,6 +35,13 @@ My commit message is my best friend. It is my life. I must master it. self.assertEqual( git_footers.split_footers('\nActual: footer'), ([''], ['Actual: footer'], [('Actual', 'footer')])) + self.assertEqual( + git_footers.split_footers('H\n\nBug:\nAlso: footer'), + (['H', ''], ['Bug:', 'Also: footer'], + [('Bug', ''), ('Also', 'footer')])) + self.assertEqual( + git_footers.split_footers('H\n\nBug: '), + (['H', ''], ['Bug: '], [('Bug', '')])) self.assertEqual( git_footers.parse_footers(self._message), {}) @@ -45,6 +52,13 @@ My commit message is my best friend. It is my life. I must master it. git_footers.parse_footers(self._message + self._position_footer + self._position_footer), { 'Cr-Commit-Position': [ self._position, self._position ] }) + self.assertEqual( + git_footers.parse_footers(self._message + + 'Bug:\n' + + self._position_footer), + { 'Bug': [''], + 'Cr-Commit-Position': [ self._position ] }) + def testGetFooterChangeId(self): msg = '\n'.join(['whatever',