Skip to content

Commit 9269dee

Browse files
committed
apply GIT_TERMINAL_PROMPT=0 to all git cmds
1 parent 2d7da57 commit 9269dee

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

modules/git/command.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,18 @@ func (c *Command) RunInDirTimeoutEnvFullPipelineFunc(env []string, timeout time.
124124

125125
cmd := exec.CommandContext(ctx, c.name, c.args...)
126126
if env == nil {
127-
cmd.Env = append(os.Environ(), fmt.Sprintf("LC_ALL=%s", DefaultLocale))
127+
cmd.Env = os.Environ()
128128
} else {
129129
cmd.Env = env
130-
cmd.Env = append(cmd.Env, fmt.Sprintf("LC_ALL=%s", DefaultLocale))
131130
}
132131

132+
cmd.Env = append(
133+
cmd.Env,
134+
fmt.Sprintf("LC_ALL=%s", DefaultLocale),
135+
// avoid prompting for credentials interactively, supported since git v2.3
136+
"GIT_TERMINAL_PROMPT=0",
137+
)
138+
133139
// TODO: verify if this is still needed in golang 1.15
134140
if goVersionLessThan115 {
135141
cmd.Env = append(cmd.Env, "GODEBUG=asyncpreemptoff=1")

modules/git/repo.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,7 @@ func CloneWithArgs(ctx context.Context, from, to string, args []string, opts Clo
147147
opts.Timeout = -1
148148
}
149149

150-
env := []string{
151-
"GIT_TERMINAL_PROMPT=0", // avoid prompting for credentials interactively, supported since git v2.3
152-
}
153-
154-
_, err = cmd.RunInDirTimeoutEnv(env, opts.Timeout, "")
150+
_, err = cmd.RunTimeout(opts.Timeout)
155151
return err
156152
}
157153

0 commit comments

Comments
 (0)