Skip to content

Commit 10b1c57

Browse files
doriableemcfarlane
andauthored
Filter out GIT_DIR from cloner environment variables (#3760)
Co-authored-by: Edward McFarlane <emcfarlane@buf.build>
1 parent 61c3b9a commit 10b1c57

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

private/pkg/git/cloner.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ func (c *cloner) CloneToBucket(
7676

7777
depthArg := strconv.Itoa(int(depth))
7878

79+
envContainer = app.NewEnvContainerWithOverrides(envContainer, map[string]string{
80+
// In the case where this is being run in an environment where GIT_DIR is set, e.g. within
81+
// a submodule, we want to treat this as a stand-alone clone rather than interacting with
82+
// an existing GIT_DIR. So we filter out GIT_DIR from our environment variables.
83+
"GIT_DIR": "",
84+
})
85+
7986
baseDir, err := tmp.NewDir(ctx)
8087
if err != nil {
8188
return err

0 commit comments

Comments
 (0)