New issue
Advanced search Search tips

Issue 766234 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: ----


Previous locations:
gerrit:7206


Sign in to add a comment

uploading a CL with a url in the last line doesn't put blank line before change-id

Project Member Reported by foolip@chromium.org, Sep 12 2017

Issue description

Many recent CLs have commit messages which aren't as intended. Two of mine:
https://chromium-review.googlesource.com/654817
https://chromium-review.googlesource.com/657646

In both cases, the URL was long and began on a new line. When written, the commit messages didn't have a blank line before the URL, and in `git cl upload` I removed the final "Bug:" line, so the URL was the last line of the commit message as initially provided.

I'm not certain at what point the commit message was changed, but https://chromium-review.googlesource.com/c/chromium/src/+/664238 is a test where I try both uploading and changing a patch, and the commit message still looks right. Therefore, I think it's only when landing a CL that the problem occurs, and that this changes the commit message of the final PS.

`git log --grep 'https: '` and the same for 'http: ' will find many recent cases of this, most probably for the same reason.
 

Comment 1 by foolip@chromium.org, Sep 12 2017

In https://chromium-review.googlesource.com/c/chromium/src/+/659017 I tried adding a space at the beginning of the line, and adding a blank line before Change-Id:. The fact that there is no space added there automatically is probably also because the preceding line is interpreted as a footer value.

Comment 2 by foolip@chromium.org, Sep 17 2017

That workaround worked.

Comment 3 by logan@google.com, Sep 18 2017

Components: -PolyGerrit
Labels: Proj-Gerrit-Migration
Sending over to chrome-infra for initial investigation.

Comment 4 by logan@google.com, Sep 18 2017

Project: chromium
Moved issue gerrit:7206 to now be  issue chromium:766234 .
Components: Infra>SDK
Labels: -Proj-Gerrit-Migration
Status: Available (was: New)
Summary: uploading a CL with a url in the last line doesn't put blank line before change-id (was: Landing a CL with CQ adds space after https: in URLs and adds blank line before them)
There should always be a blank line before the Change-Id. Git "trailers", as those colon-separated key-value pairs are called, are only valid in a standalone paragraph at the end of the message. The changes that you're uploading have no blank line between the last paragraph and the change-id (as seen here https://canary-chromium-review.googlesource.com/c/chromium/src/+/654817/1//COMMIT_MSG in your initial upload), but they definitely should.

I uploaded https://canary-chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/849533 to test, and it looks like git-cl-upload does the wrong thing when adding the change-id line when the last line is a url.

So while there is a problem here that urls get spaces added to them by Gerrit, the bigger problem is that git-cl-upload doesn't put a blank line before the Change-Id. I'll see what I can do about that.
Labels: Pri-2
I also filed https://bugs.chromium.org/p/gerrit/issues/detail?id=8069 to follow up on the Gerrit side of this.
Owner: aga...@chromium.org
Status: Started (was: Available)
https://chromium-review.googlesource.com/#/c/chromium/tools/depot_tools/+/849481
Project Member

Comment 9 by bugdroid1@chromium.org, Jan 4 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/tools/depot_tools/+/d9a6756b24ae9db0f6bdcc150847d7899e0a50dc

commit d9a6756b24ae9db0f6bdcc150847d7899e0a50dc
Author: Aaron Gable <agable@chromium.org>
Date: Thu Jan 04 00:03:18 2018

Blacklist http(s): from being parsed as a git footer

It's unlikely that anyone would ever intend to have a git trailer
whose key is "http", but since URLs are often long, it is rather
likely that someone would put a URL on a line all by itself. When
that happens, don't accidentally interpret it as a footer.

R=iannucci, tandrii

Bug:  766234 
Change-Id: I3101119c4e49e20339487618cc1719452b026d90
Reviewed-on: https://chromium-review.googlesource.com/849484
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>

[modify] https://crrev.com/d9a6756b24ae9db0f6bdcc150847d7899e0a50dc/git_footers.py
[modify] https://crrev.com/d9a6756b24ae9db0f6bdcc150847d7899e0a50dc/tests/git_footers_test.py

Project Member

Comment 10 by bugdroid1@chromium.org, Jan 4 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/tools/depot_tools/+/4be31878a83fcd36834280abbfbc139516b069cf

commit 4be31878a83fcd36834280abbfbc139516b069cf
Author: Aaron Gable <agable@chromium.org>
Date: Thu Jan 04 00:37:38 2018

Let git_footers split final paragraphs in specific cases

Suppose the final paragraph of a commit message looks like this:
    """
    And here's the final paragraph.
    Bug:  1234 
    TBR=soandso
    Change-Id: deadbeef
    """
In this case, we don't want to lose the Bug and Change-Id footers,
so we process the whole final paragraph. *But* we'd also like to
help the user get things formatted correctly. This change lets
git_footers notice this situation, and insert a newline before the
first well-formed footer (Bug: in this case), so that the set of
well- and mal-formed footers are separated from the rest of the
malformed body text.

In the rare case where the last line of the last non-trailer paragraph
is a url, this will also visibly push the url into the block of
trailers (where it doesn't belong), prompting the user to fix it.
A more comprehensive fix for that particular case is coming later.

Bug:  766234 
Change-Id: I6ae0072fff68ddf06e6f43b70f9a82a7f247f4ab
Reviewed-on: https://chromium-review.googlesource.com/849481
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>

[modify] https://crrev.com/4be31878a83fcd36834280abbfbc139516b069cf/git_footers.py
[modify] https://crrev.com/4be31878a83fcd36834280abbfbc139516b069cf/tests/git_footers_test.py

Status: Fixed (was: Started)
Thanks agable@!

Sign in to add a comment