Skip to content

Commit bd9da1b

Browse files
prattmicgopherbot
authored andcommitted
cmd/gomote: don't push .git even if it is a file
In `git worktree` checkouts, rather than a .git directory, .git is a file containing the path of the real repository. Presence of this file will confuse git invoked by the go tool, so don't push it, just as we don't push a .git directory. For golang/go#58218. Change-Id: I2d316d5672a87ba9cb7175a07e06e99a3392a85d Reviewed-on: https://go-review.googlesource.com/c/build/+/480635 Reviewed-by: Carlos Amedee <amedee@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Michael Pratt <mpratt@google.com>
1 parent 579d681 commit bd9da1b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: cmd/gomote/push.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,21 @@ func doPush(ctx context.Context, name, goroot string, dryRun, detailedProgress b
179179
if rel == "." {
180180
return nil
181181
}
182+
if rel == ".git" {
183+
if fi.IsDir() {
184+
return filepath.SkipDir
185+
}
186+
return nil // .git is a file in `git worktree` checkouts.
187+
}
182188
if fi.IsDir() {
183189
switch rel {
184-
case ".git", "pkg", "bin":
190+
case "pkg", "bin":
185191
return filepath.SkipDir
186192
}
187193
}
188194
inf := fileInfo{fi: fi}
189195
if isGitIgnored(path) {
190-
if fi.Mode().IsDir() {
196+
if fi.IsDir() {
191197
return filepath.SkipDir
192198
}
193199
return nil

0 commit comments

Comments
 (0)