New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/review/git-codereview: incorrect handling of commit --verbose #16376
Comments
I can partially reproduce--I get a Change-Id, but the diff still shows up in the commit message. Not sure what the right fix is. I guess we could teach the hook to look for the line:
and cut everything after it. Maybe there's a better way, but at first glance, I don't really see how hooks are intended to interact with commit --verbose other than by manually reproducing git's behavior. |
I'd happily review a CL fixing this if you want to send one. |
I wonder why I'm not getting the As for the verbose option, I'll investigate and post a CL if indeed we are supposed to work around this. |
Just curious, what git version are you using? If someone could test the |
I'm using 2.9, but without the config flag. I tested using |
Removing the hooks and re-running As for
All I could find is other projects doing this line inspection that you proposed. I'll send a CL tomorrow, as I use this option frequently. |
CL https://golang.org/cl/25342 mentions this issue. |
See golang/go#16376, and the related https://go-review.googlesource.com/#/c/25342/. Prior to this change, `git commit -v` would result in a nonsensical commit message. Change-Id: Ib11de27488b01fccff07b9385f7fa988bc6fe165
go version
)?go env
)?Follow https://golang.org/doc/contribute.html to send my first CL.
commit-msg
would work as expected, addingChange-Id
and leaving the rest.First, the
commit-msg
hook got confused by this in my.gitconfig
:This is a new option (since 2.9) that spits out the diff at the bottom of the commit message file in every commit that git does. Useful to see what you're committing. The hook, though, included this diff in the final commit message instead of ignoring it. Note that the diff isn't commented out, but it's after the
# Everything below will be removed.
line.Once I removed the option from my
.gitconfig
, that got fixed. But then theChange-Id
would still not appear.I had to follow the
git codereview mail
instructions, which did give me a hook that actually worked:The text was updated successfully, but these errors were encountered: