Skip to content

Commit 6493fd0

Browse files
jedevctonistiigi
authored andcommitted
git: ensure exec option is propagated to child git clis
Signed-off-by: Justin Chadwell <[email protected]>
1 parent 2d69a25 commit 6493fd0

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

util/gitutil/git_cli.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,13 @@ func NewGitCLI(opts ...Option) *GitCLI {
119119
// New returns a new git client with the same config as the current one, but
120120
// with the given options applied on top.
121121
func (cli *GitCLI) New(opts ...Option) *GitCLI {
122-
c := &GitCLI{
123-
git: cli.git,
124-
dir: cli.dir,
125-
workTree: cli.workTree,
126-
gitDir: cli.gitDir,
127-
args: append([]string{}, cli.args...),
128-
streams: cli.streams,
129-
sshAuthSock: cli.sshAuthSock,
130-
sshKnownHosts: cli.sshKnownHosts,
131-
}
122+
clone := *cli
123+
clone.args = append([]string{}, cli.args...)
124+
132125
for _, opt := range opts {
133-
opt(c)
126+
opt(&clone)
134127
}
135-
return c
128+
return &clone
136129
}
137130

138131
// Run executes a git command with the given args.

0 commit comments

Comments
 (0)