#3505 use user’s info for committer and author

tokarchuk/v1.17
Unknwon 8 years ago
parent 13c106af77
commit c30b856d14
  1. 2
      .gopmfile
  2. 2
      README.md
  3. 2
      cmd/web.go
  4. 2
      glide.lock
  5. 2
      gogs.go
  6. 5
      models/repo.go
  7. 20
      models/repo_editor.go
  8. 2
      models/user.go
  9. 10
      models/wiki.go
  10. 2
      templates/.VERSION

@ -18,7 +18,7 @@ github.com/go-xorm/core = commit:5bf745d
github.com/go-xorm/xorm = commit:c6c7056 github.com/go-xorm/xorm = commit:c6c7056
github.com/gogits/chardet = commit:2404f77 github.com/gogits/chardet = commit:2404f77
github.com/gogits/cron = commit:7f3990a github.com/gogits/cron = commit:7f3990a
github.com/gogits/git-module = commit:7b206b5 github.com/gogits/git-module = commit:0a18ab0
github.com/gogits/go-gogs-client = commit:c52f7ee github.com/gogits/go-gogs-client = commit:c52f7ee
github.com/issue9/identicon = commit:d36b545 github.com/issue9/identicon = commit:d36b545
github.com/jaytaylor/html2text = commit:52d9b78 github.com/jaytaylor/html2text = commit:52d9b78

@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current tip version: 0.9.88 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions) ##### Current tip version: 0.9.89 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

@ -88,7 +88,7 @@ func checkVersion() {
{"github.com/go-macaron/toolbox", toolbox.Version, "0.1.0"}, {"github.com/go-macaron/toolbox", toolbox.Version, "0.1.0"},
{"gopkg.in/ini.v1", ini.Version, "1.8.4"}, {"gopkg.in/ini.v1", ini.Version, "1.8.4"},
{"gopkg.in/macaron.v1", macaron.Version, "1.1.7"}, {"gopkg.in/macaron.v1", macaron.Version, "1.1.7"},
{"github.com/gogits/git-module", git.Version, "0.3.8"}, {"github.com/gogits/git-module", git.Version, "0.4.0"},
{"github.com/gogits/go-gogs-client", gogs.Version, "0.12.1"}, {"github.com/gogits/go-gogs-client", gogs.Version, "0.12.1"},
} }
for _, c := range checkers { for _, c := range checkers {

2
glide.lock generated

@ -41,7 +41,7 @@ imports:
- name: github.com/gogits/cron - name: github.com/gogits/cron
version: 7f3990acf1833faa5ebd0e86f0a4c72a4b5eba3c version: 7f3990acf1833faa5ebd0e86f0a4c72a4b5eba3c
- name: github.com/gogits/git-module - name: github.com/gogits/git-module
version: 7b206b529a09ae8cfa1df52a6c0cdd2612cfc6fc version: 0a18ab0f2b896dbf510de515a00a698a2de5719c
- name: github.com/gogits/go-gogs-client - name: github.com/gogits/go-gogs-client
version: c52f7ee0cc58d3cd6e379025552873a8df6de322 version: c52f7ee0cc58d3cd6e379025552873a8df6de322
- name: github.com/issue9/identicon - name: github.com/issue9/identicon

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.9.88.0827" const APP_VER = "0.9.89.0827"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

@ -2303,7 +2303,10 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t
if err = git.AddChanges(localPath, true); err != nil { if err = git.AddChanges(localPath, true); err != nil {
return fmt.Errorf("AddChanges: %v", err) return fmt.Errorf("AddChanges: %v", err)
} else if err = git.CommitChanges(localPath, message, doer.NewGitSig()); err != nil { } else if err = git.CommitChanges(localPath, git.CommitChangesOptions{
Committer: doer.NewGitSig(),
Message: message,
}); err != nil {
return fmt.Errorf("CommitChanges: %v", err) return fmt.Errorf("CommitChanges: %v", err)
} else if err = git.Push(localPath, "origin", branchName); err != nil { } else if err = git.Push(localPath, "origin", branchName); err != nil {
return fmt.Errorf("Push: %v", err) return fmt.Errorf("Push: %v", err)

@ -127,11 +127,11 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
if err = git.AddChanges(localPath, true); err != nil { if err = git.AddChanges(localPath, true); err != nil {
return fmt.Errorf("git add --all: %v", err) return fmt.Errorf("git add --all: %v", err)
} } else if err = git.CommitChanges(localPath, git.CommitChangesOptions{
Committer: doer.NewGitSig(),
signaure := doer.NewGitSig() Message: opts.Message,
if err = git.CommitChanges(localPath, opts.Message, signaure); err != nil { }); err != nil {
return fmt.Errorf("git commit -m %s --author='%s <%s>': %v", opts.Message, signaure.Name, signaure.Email, err) return fmt.Errorf("CommitChanges: %v", err)
} else if err = git.Push(localPath, "origin", opts.NewBranch); err != nil { } else if err = git.Push(localPath, "origin", opts.NewBranch); err != nil {
return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err) 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 { if err = git.AddChanges(localPath, true); err != nil {
return fmt.Errorf("git add --all: %v", err) return fmt.Errorf("git add --all: %v", err)
} } else if err = git.CommitChanges(localPath, git.CommitChangesOptions{
Committer: doer.NewGitSig(),
signaure := doer.NewGitSig() Message: opts.Message,
if err = git.CommitChanges(localPath, opts.Message, signaure); err != nil { }); err != nil {
return fmt.Errorf("git commit -m %s --author='%s <%s>': %v", opts.Message, signaure.Name, signaure.Email, err) return fmt.Errorf("CommitChanges: %v", err)
} else if err = git.Push(localPath, "origin", opts.Branch); err != nil { } else if err = git.Push(localPath, "origin", opts.Branch); err != nil {
return fmt.Errorf("git push origin %s: %v", opts.Branch, err) return fmt.Errorf("git push origin %s: %v", opts.Branch, err)
} }

@ -308,7 +308,7 @@ func (u *User) GetFollowing(page int) ([]*User, error) {
// NewGitSig generates and returns the signature of given user. // NewGitSig generates and returns the signature of given user.
func (u *User) NewGitSig() *git.Signature { func (u *User) NewGitSig() *git.Signature {
return &git.Signature{ return &git.Signature{
Name: u.Name, Name: u.DisplayName(),
Email: u.Email, Email: u.Email,
When: time.Now(), When: time.Now(),
} }

@ -129,7 +129,10 @@ func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, mes
} }
if err = git.AddChanges(localPath, true); err != nil { if err = git.AddChanges(localPath, true); err != nil {
return fmt.Errorf("AddChanges: %v", err) return fmt.Errorf("AddChanges: %v", err)
} else if err = git.CommitChanges(localPath, message, doer.NewGitSig()); err != nil { } else if err = git.CommitChanges(localPath, git.CommitChangesOptions{
Committer: doer.NewGitSig(),
Message: message,
}); err != nil {
return fmt.Errorf("CommitChanges: %v", err) return fmt.Errorf("CommitChanges: %v", err)
} else if err = git.Push(localPath, "origin", "master"); err != nil { } else if err = git.Push(localPath, "origin", "master"); err != nil {
return fmt.Errorf("Push: %v", err) return fmt.Errorf("Push: %v", err)
@ -165,7 +168,10 @@ func (repo *Repository) DeleteWikiPage(doer *User, title string) (err error) {
if err = git.AddChanges(localPath, true); err != nil { if err = git.AddChanges(localPath, true); err != nil {
return fmt.Errorf("AddChanges: %v", err) return fmt.Errorf("AddChanges: %v", err)
} else if err = git.CommitChanges(localPath, message, doer.NewGitSig()); err != nil { } else if err = git.CommitChanges(localPath, git.CommitChangesOptions{
Committer: doer.NewGitSig(),
Message: message,
}); err != nil {
return fmt.Errorf("CommitChanges: %v", err) return fmt.Errorf("CommitChanges: %v", err)
} else if err = git.Push(localPath, "origin", "master"); err != nil { } else if err = git.Push(localPath, "origin", "master"); err != nil {
return fmt.Errorf("Push: %v", err) return fmt.Errorf("Push: %v", err)

@ -1 +1 @@
0.9.88.0827 0.9.89.0827
Loading…
Cancel
Save