Skip to content

Commit 7f93ac5

Browse files
authored
fix: Fix write-back commits (argoproj-labs#767)
Signed-off-by: jannfis <[email protected]>
1 parent ae3eec3 commit 7f93ac5

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FROM alpine:3.19
1414

1515
RUN apk update && \
1616
apk upgrade && \
17-
apk add ca-certificates git openssh-client aws-cli tini && \
17+
apk add ca-certificates git openssh-client aws-cli tini gpg && \
1818
rm -rf /var/cache/apk/*
1919

2020
RUN mkdir -p /usr/local/bin

ext/git/writer.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,21 @@ func (m *nativeGitClient) Commit(pathSpec string, opts *CommitOptions) error {
3232
defaultCommitMsg := "Update parameters"
3333
// Git configuration
3434
config := "gpg.format=" + opts.SigningMethod
35-
args := []string{"-c", config, "commit"}
35+
args := []string{}
36+
// -c is a global option and needs to be passed before the actual git sub
37+
// command (commit).
38+
if opts.SigningMethod != "" {
39+
args = append(args, "-c", config)
40+
}
41+
args = append(args, "commit")
3642
if pathSpec == "" || pathSpec == "*" {
3743
args = append(args, "-a")
3844
}
3945
// Commit fails with a space between -S flag and path to SSH key
4046
// -S/user/test/.ssh/signingKey or -SAAAAAAAA...
41-
args = append(args, fmt.Sprintf("-S%s", opts.SigningKey))
47+
if opts.SigningKey != "" {
48+
args = append(args, fmt.Sprintf("-S%s", opts.SigningKey))
49+
}
4250
if opts.SignOff {
4351
args = append(args, "-s")
4452
}

0 commit comments

Comments
 (0)