diff --git a/git_cl.py b/git_cl.py index face2d48c..136ba15e1 100755 --- a/git_cl.py +++ b/git_cl.py @@ -3083,8 +3083,8 @@ class ChangeDescription(object): ] + self._description_lines) regexp = re.compile(self.BUG_LINE) + prefix = settings.GetBugPrefix() if not any((regexp.match(line) for line in self._description_lines)): - prefix = settings.GetBugPrefix() values = list(_get_bug_line_values(prefix, bug or '')) or [prefix] if git_footer: self.append_footer('Bug: %s' % ', '.join(values)) @@ -3100,7 +3100,9 @@ class ChangeDescription(object): # Strip off comments and default inserted "Bug:" line. clean_lines = [line.rstrip() for line in lines if not - (line.startswith('#') or line.rstrip() == "Bug:")] + (line.startswith('#') or + line.rstrip() == "Bug:" or + line.rstrip() == "Bug: " + prefix)] if not clean_lines: DieWithError('No CL description, aborting') self.set_description(clean_lines) diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index f71a5d5dd..63ac18f37 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -964,6 +964,7 @@ class TestGitCl(TestCase): if not issue: # Prompting to edit description on first upload. calls += [ + ((['git', 'config', 'rietveld.bug-prefix'],), ''), ((['git', 'config', 'core.editor'],), ''), ((['RunEditor'],), description), ]