diff options
author | Unknwon <u@gogs.io> | 2016-08-27 13:37:55 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-27 13:37:55 -0700 |
commit | c30b856d147dd895507c8f2334a11ed4baab6c18 (patch) | |
tree | b0212b58f1026ba581f3f9c0ef1a366a5c4706df /models/repo_editor.go | |
parent | 13c106af7764a0b4757348ab4c82dbf9154ee11c (diff) | |
download | gitea-c30b856d147dd895507c8f2334a11ed4baab6c18.tar.gz gitea-c30b856d147dd895507c8f2334a11ed4baab6c18.zip |
#3505 use user’s info for committer and author
Diffstat (limited to 'models/repo_editor.go')
-rw-r--r-- | models/repo_editor.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/models/repo_editor.go b/models/repo_editor.go index e89ad0a401..a773c8d36f 100644 --- a/models/repo_editor.go +++ b/models/repo_editor.go @@ -127,11 +127,11 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) ( if err = git.AddChanges(localPath, true); err != nil { return fmt.Errorf("git add --all: %v", err) - } - - signaure := doer.NewGitSig() - if err = git.CommitChanges(localPath, opts.Message, signaure); err != nil { - return fmt.Errorf("git commit -m %s --author='%s <%s>': %v", opts.Message, signaure.Name, signaure.Email, err) + } else if err = git.CommitChanges(localPath, git.CommitChangesOptions{ + Committer: doer.NewGitSig(), + Message: opts.Message, + }); err != nil { + return fmt.Errorf("CommitChanges: %v", err) } else if err = git.Push(localPath, "origin", opts.NewBranch); err != nil { return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err) } @@ -254,11 +254,11 @@ func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) ( if err = git.AddChanges(localPath, true); err != nil { return fmt.Errorf("git add --all: %v", err) - } - - signaure := doer.NewGitSig() - if err = git.CommitChanges(localPath, opts.Message, signaure); err != nil { - return fmt.Errorf("git commit -m %s --author='%s <%s>': %v", opts.Message, signaure.Name, signaure.Email, err) + } else if err = git.CommitChanges(localPath, git.CommitChangesOptions{ + Committer: doer.NewGitSig(), + Message: opts.Message, + }); err != nil { + return fmt.Errorf("CommitChanges: %v", err) } else if err = git.Push(localPath, "origin", opts.Branch); err != nil { return fmt.Errorf("git push origin %s: %v", opts.Branch, err) } |