New issue
Advanced search Search tips

Issue 9195 link

Starred by 2 users

Issue metadata

Status: Submitted
Owner:
Closed: Jun 9



Sign in to add a comment

Strange behavior when creating change in webUI and message starts with #

Project Member Reported by david.pu...@gmail.com, Jun 7

Issue description

*****************************************************************
*****                                                       *****
***** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!!  *****
*****                                                       *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, CYANOGENMOD,  *****
***** INTERNAL ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.*****
*****                                                       *****
*****   THOSE ISSUES BELONG IN DIFFERENT ISSUE TRACKERS     *****
*****                                                       *****
*****************************************************************

Affected Version: 2.14.8

What steps will reproduce the problem?
1. Create a change from the UI with the commit message "#12345 Test"
2.
3.

What is the expected output?

change can be created

What do you see instead?

invalid Change-Id line format in commit message footer

Please provide any additional information below.

As reported on the mailing list:

https://groups.google.com/forum/#!topic/repo-discuss/1XrWFNN1TQw

 
I've added a test that reproduces the issue.  The problem is that when the commit message only consists of a subject beginning with "#", the call:

	ChangeIdUtil.computeChangeId(treeId, mergeTip, author, author, commitMessage);

is returning null and then this results in a zero Change-Id being generated.

According to computeChangeId's Javadoc, it returns null "if the message is not complete enough".

In this case it's returning null because it calls the clean method on the commit message, which removes all lines beginning with # (they are considered comment lines):

	static String clean(String msg) {
		return msg.//
				replaceAll("(?i)(?m)^Signed-off-by:.*$\n?", "").// //$NON-NLS-1$
				replaceAll("(?m)^#.*$\n?", "").// //$NON-NLS-1$
				replaceAll("(?m)\n\n\n+", "\\\n").// //$NON-NLS-1$
				replaceAll("\\n*$", "").// //$NON-NLS-1$
				replaceAll("(?s)\ndiff --git.*", "").// //$NON-NLS-1$
				trim();
	}

Status: Started (was: New)
Status: ChangeUnderReview (was: Started)
https://gerrit-review.googlesource.com/#/c/gerrit/+/183350
Labels: FixedIn-2.14.9
Status: Submitted (was: ChangeUnderReview)

Sign in to add a comment