From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: git@vger.kernel.org
Cc: masahiroy@kernel.org
Subject: 'git interpret-trailers' is tripped by comment characters other than '#'
Date: Fri, 14 Jun 2019 20:35:04 +0900 [thread overview]
Message-ID: <CAK7LNAR=KhTZRFFXTbcZwe-+65fGnVB7NbmVbQ7ymbmChDuhAg@mail.gmail.com> (raw)
Hi.
When I tried to add ChangeId tag for Gerrit Code Review,
I noticed 'git interpret-trailers' went wrong
if a comment character other than '#' is used.
Quick Test Code
---------------
cat <<EOF | git -c trailer.ifexists=doNothing interpret-trailers \
--trailer "Change-Id: new tag"
subject: this is commit subject
Blah Blah
Change-Id: old tag
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
; This is a comment line with non-default char
EOF
[result]
subject: this is commit subject
Blah Blah
Change-Id: old tag
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
; This is a comment line with non-default char
Change-Id: new tag
The same trailer 'Change-Id' was appended,
ignoring trailer.ifexists=doNothing
Details
-------
For Gerrit Code Review, we add "Change-Id" tag,
which will identify the patch though the review process.
For details, you can refer:
https://www.gerritcodereview.com/cmd-hook-commit-msg.html
Gerrit provides a shell script "commit-msg",
which is hooked from 'git commit'.
You can see its implementation here:
https://github.com/GerritCodeReview/gerrit/blob/v3.0.0/resources/com/google/gerrit/server/tools/root/hooks/commit-msg
It is implemented by using
'git interpret-trailers'.
I prefer ';' to '#" for commit comment lines.
So, I add the following:
[core]
commentChar = ";"
With core.commentChar is set,
'git interpret-trailers' is so confused
that accumulate the same tag for every 'git commit --amend'.
I guess this should be fixed on the Git side.
Perhaps, 'git interpret-trailers' should be changed
to recognize core.commentChar ?
--
Best Regards
Masahiro Yamada
next reply other threads:[~2019-06-14 11:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 11:35 Masahiro Yamada [this message]
2019-06-14 15:07 ` 'git interpret-trailers' is tripped by comment characters other than '#' Jeff King
2019-06-15 8:41 ` Christian Couder
2019-06-17 4:32 ` Masahiro Yamada
2019-06-17 5:03 ` Christian Couder
2019-06-17 17:31 ` Junio C Hamano
2019-06-17 20:07 ` Christian Couder
2019-06-18 2:41 ` Masahiro Yamada
2019-06-19 3:37 ` [PATCH] interpret-trailers: load default config Jeff King
2019-06-19 14:24 ` Junio C Hamano
2019-06-19 17:47 ` Jeff King
2019-06-19 15:52 ` Masahiro Yamada
2019-06-17 4:32 ` 'git interpret-trailers' is tripped by comment characters other than '#' Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAK7LNAR=KhTZRFFXTbcZwe-+65fGnVB7NbmVbQ7ymbmChDuhAg@mail.gmail.com' \
--to=yamada.masahiro@socionext.com \
--cc=git@vger.kernel.org \
--cc=masahiroy@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).