Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Refactors forgotten bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamara Kaufler committed Sep 13, 2017
1 parent b71d165 commit 54b81f2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit 54b81f2

Please sign in to comment.