Skip to content

Commit 691f2b9

Browse files
committed
Use app.NewEnvContainerWithOverrides
1 parent 7b897a1 commit 691f2b9

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

private/pkg/git/cloner.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,12 @@ func (c *cloner) CloneToBucket(
7676

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

79-
// In the case where this is being run in an environment where GIT_DIR is set, e.g. within
80-
// a submodule, we want to treat this as a stand-alone clone rather than interacting with
81-
// an existing GIT_DIR. So we filter out GIT_DIR from our environment variables.
82-
filteredEnv := make(map[string]string)
83-
envContainer.ForEachEnv(func(key, value string) {
84-
if key != "GIT_DIR" {
85-
filteredEnv[key] = value
86-
}
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": "",
8784
})
88-
envContainer = app.NewEnvContainer(filteredEnv)
8985

9086
baseDir, err := tmp.NewDir(ctx)
9187
if err != nil {

0 commit comments

Comments
 (0)