summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJann Fischer <jann@mistrust.net>2024-07-05 09:26:01 -0400
committerGitHub <noreply@github.com>2024-07-05 09:26:01 -0400
commit7f93ac538917325afd05e5ca6a18f423fa503195 (patch)
tree73ba5033358b865093732c4ccd77fa6529217685 /ext
parentae3eec3ff69487d13da770abd9167c61ac957931 (diff)
fix: Fix write-back commits (#767)
Signed-off-by: jannfis <jann@mistrust.net>
Diffstat (limited to 'ext')
-rw-r--r--ext/git/writer.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/git/writer.go b/ext/git/writer.go
index 94535ae..9178865 100644
--- a/ext/git/writer.go
+++ b/ext/git/writer.go
@@ -32,13 +32,21 @@ func (m *nativeGitClient) Commit(pathSpec string, opts *CommitOptions) error {
defaultCommitMsg := "Update parameters"
// Git configuration
config := "gpg.format=" + opts.SigningMethod
- args := []string{"-c", config, "commit"}
+ args := []string{}
+ // -c is a global option and needs to be passed before the actual git sub
+ // command (commit).
+ if opts.SigningMethod != "" {
+ args = append(args, "-c", config)
+ }
+ args = append(args, "commit")
if pathSpec == "" || pathSpec == "*" {
args = append(args, "-a")
}
// Commit fails with a space between -S flag and path to SSH key
// -S/user/test/.ssh/signingKey or -SAAAAAAAA...
- args = append(args, fmt.Sprintf("-S%s", opts.SigningKey))
+ if opts.SigningKey != "" {
+ args = append(args, fmt.Sprintf("-S%s", opts.SigningKey))
+ }
if opts.SignOff {
args = append(args, "-s")
}