diff --git a/daemon/daemon.go b/daemon/daemon.go index 26723195a8..0912f219d4 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -253,7 +253,10 @@ func (d *Daemon) updatePolicy(spec update.Spec, updates policy.Updates) DaemonJo return metadata, nil } - commitAuthor := getCommitAuthor(d.Checkout.Config.SetAuthor, spec.Cause.User) + commitAuthor := "" + if d.Checkout.Config.SetAuthor { + commitAuthor = spec.Cause.User + } commitAction := &git.CommitAction{Author: commitAuthor, Message: policyCommitMessage(updates, spec.Cause)} if err := working.CommitAndPush(ctx, commitAction, &git.Note{JobID: jobID, Spec: spec}); err != nil { // On the chance pushing failed because it was not @@ -289,7 +292,10 @@ func (d *Daemon) release(spec update.Spec, c release.Changes) DaemonJobFunc { if commitMsg == "" { commitMsg = c.CommitMessage() } - commitAuthor := getCommitAuthor(d.Checkout.Config.SetAuthor, spec.Cause.User) + commitAuthor := "" + if d.Checkout.Config.SetAuthor { + commitAuthor = spec.Cause.User + } commitAction := &git.CommitAction{Author: commitAuthor, Message: commitMsg} if err := working.CommitAndPush(ctx, commitAction, &git.Note{JobID: jobID, Spec: spec, Result: result}); err != nil { // On the chance pushing failed because it was not @@ -516,10 +522,3 @@ func policyEventTypes(u policy.Update) []string { sort.Strings(result) return result } - -func getCommitAuthor(setAuthor bool, author string) string { - if !setAuthor { - author = "" - } - return author -}