Open hnakamur opened 2 weeks ago
Thanks for reporting this.
The git configuration surface is quite large, and this appears to be a case where one of the configuration values conflicts with the expectations of git-codereview, causing test errors.
Can you clarify if this is causing a problem for your workflow? Or are you simply reporting it because you spotted it?
While git-codereview can be updated for this particular case, it might not be viable to do that holistically. An alternative approach is to not to use this configuration when working with Go repositories. For example, that can be done by running git config --local commit.gpgsign false
inside Go repositories where you need to use git-codereview. Would that work?
Thanks for your comment.
I reported this simply I spotted it.
Sorry I was not accurate about the description in "What did you do?" section.
Actually I happen to set commit.gpgsign
and tag.gpgsign
to true
in my ~/.gitconfig
.
I tried again with setting commit.gpgsign
and tag.gpgsign
to false
locally:
$ git config --local commig.gpgsign false
$ git config --local tag.gpgsign false
Verify the configs:
$ git config --get-all commit.gpgsign
true
false
$ git config --get-all tag.gpgsign
true
false
Test still fails, for example:
$ go test -v -run TestHookPreCommitEnv
=== RUN TestHookPreCommitEnv
hook_test.go:328: in git-client/, ran [git tag work] with git version 2.39.2
:
exit status 1
error: There was a problem with the editor 'false'.
Please supply the message using either -m or -F option.
--- FAIL: TestHookPreCommitEnv (0.30s)
FAIL
exit status 1
FAIL golang.org/x/review/git-codereview 0.304s
The commit used for test is:
$ git rev-parse HEAD
c91ae924997076a8e6e6f16d1d9fb75f812e0cdd
However with the following diff (in my local git branch):
$ git diff HEAD~
diff --git a/git-codereview/util_test.go b/git-codereview/util_test.go
index 931d017..932e7ab 100644
--- a/git-codereview/util_test.go
+++ b/git-codereview/util_test.go
@@ -200,6 +200,7 @@ func newGitTest(t *testing.T) (gt *gitTest) {
write(t, client+"/.git/hooks/"+h, "#!/bin/sh\nexit 0\n", 0755)
}
+ trun(t, client, "git", "config", "tag.gpgsign", "false")
trun(t, client, "git", "config", "core.editor", "false")
pwd, err := os.Getwd()
if err != nil {
Now the test passes:
$ go test -v -run TestHookPreCommitEnv
=== RUN TestHookPreCommitEnv
hook_test.go:335: git-codereview hook-invoke pre-commit
hook_test.go:335: stderr:
git-codereview pre-commit gofmt hook disabled by $GIT_GOFMT_HOOK=off
--- PASS: TestHookPreCommitEnv (0.35s)
PASS
ok golang.org/x/review/git-codereview 0.354s
Go version
go version go1.22.2 linux/amd64
Output of
go env
in your module/workspace:What did you do?
git config --global commit.gpgsign true git clone https://go.googlesource.com/review cd review go test -v
What did you see happen?
Errors like below occurred:
What did you expect to see?
All test passes.