squash commit signing
This commit is contained in:
+12
-1
@@ -226,7 +226,18 @@ func SquashCommit(repo, worktree, target, message string, env []string) (string,
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return runEnv(repo, env, "commit-tree", lines[0], "-p", head, "-m", message)
|
||||
args := []string{"commit-tree", lines[0], "-p", head, "-m", message}
|
||||
sign, stderr, code, err := runCode(repo, nil, "config", "--type=bool", "--get", "commit.gpgsign")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if code != 0 && code != 1 {
|
||||
return "", fmt.Errorf("git config --get commit.gpgsign: exit status %d: %s", code, stderr)
|
||||
}
|
||||
if sign == "true" {
|
||||
args = append(args, "-S")
|
||||
}
|
||||
return runEnv(repo, env, args...)
|
||||
}
|
||||
|
||||
const Remote = "origin"
|
||||
|
||||
Reference in New Issue
Block a user