-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/go: 1.20 broke buildvcs inside bare Git repositories with worktrees #59068
Comments
Seems to be introduced in bb39656 that added checks for file mode when searching for repository root. |
For reference, in Git work trees, https://github.com/git/git/blob/73876f4861cd3d187a4682290ab75c9dccadbc56/setup.c#L843-L866 |
I’m not really sure if bb39656 was the right way to fix the case in #53640, which had a broken Git repository in the first place (since only the submodule was copied to the Docker container without the Git directory). Before this change, VCS stamping worked in perfectly valid Git repositories with gitdir link but did not in “broken” (i.e. where |
Oh, right, sorry for not looking up existing issues! I known that work trees are somewhat an advanced Git feature and are likely used by a minority of users, and since this wasn’t fixed yet I’ve assumed that nobody reported this issue 😅 Will the fix be eventually backported to 1.20 release? |
Yes, this is a duplicate. And I would say we would backport the revert, given that it's a regression and the revert should be relatively harmless. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, this issue was introduced in Go 1.20 release.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go20-buildvcs-issue.sh
Go 1.19
Go 1.20
Notice that Go 1.19 works fine with this setup.
A shorter reproducer for this bug:
go20-buildvcs-issue.sh
Also note that this is not an issue with Go version in Nixpkgs, the examples above use nix just to avoid installing different Go versions.
What did you expect to see?
All builds succeed.
What did you see instead?
Go 1.20 runs
git status --porcelain
outside of the Git work tree, the command fails withfatal: this operation must be run in a work tree
error.The text was updated successfully, but these errors were encountered: