Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion git_wapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ func commit(msg commitMsg) error {
return err
}

_, err = git("commit", "-F", f.Name())
gpgSignedCommit := ""
if hasGPGSignedCommit() {
gpgSignedCommit = "-S"
}
_, err = git("commit", gpgSignedCommit, "-F", f.Name())
if err != nil {
return err
}
Expand All @@ -65,6 +69,15 @@ func push() (string, error) {
return msg, err
}

func hasGPGSignedCommit() bool {
msg, err := git("config", "--get", "commit.gpgsign")
if err != nil {
fmt.Println("Cannot verify if GPG sign commit because", err)
return false
}
return msg == "true"
}

func hasStagedFiles() error {
msg, err := git("diff", "--cached", "--name-only")
if err != nil {
Expand Down