Selaa lähdekoodia

#3505 use user’s info for committer and author

Unknwon 8 vuotta sitten
vanhempi
commit
c30b856d14
10 muutettua tiedostoa jossa 29 lisäystä ja 20 poistoa
  1. 1 1
      .gopmfile
  2. 1 1
      README.md
  3. 1 1
      cmd/web.go
  4. 1 1
      glide.lock
  5. 1 1
      gogs.go
  6. 4 1
      models/repo.go
  7. 10 10
      models/repo_editor.go
  8. 1 1
      models/user.go
  9. 8 2
      models/wiki.go
  10. 1 1
      templates/.VERSION

+ 1 - 1
.gopmfile

@@ -18,7 +18,7 @@ github.com/go-xorm/core = commit:5bf745d
 github.com/go-xorm/xorm = commit:c6c7056
 github.com/gogits/chardet = commit:2404f77
 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/issue9/identicon = commit:d36b545
 github.com/jaytaylor/html2text = commit:52d9b78

+ 1 - 1
README.md

@@ -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)
 
-##### 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  |
 |:-------------:|:-------:|:-------:|

+ 1 - 1
cmd/web.go

@@ -88,7 +88,7 @@ func checkVersion() {
 		{"github.com/go-macaron/toolbox", toolbox.Version, "0.1.0"},
 		{"gopkg.in/ini.v1", ini.Version, "1.8.4"},
 		{"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"},
 	}
 	for _, c := range checkers {

+ 1 - 1
glide.lock

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

+ 1 - 1
gogs.go

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

+ 4 - 1
models/repo.go

@@ -2303,7 +2303,10 @@ func (repo *Repository) UploadRepoFiles(doer *User, oldBranchName, branchName, t
 
 	if err = git.AddChanges(localPath, true); err != nil {
 		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)
 	} else if err = git.Push(localPath, "origin", branchName); err != nil {
 		return fmt.Errorf("Push: %v", err)

+ 10 - 10
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)
 	}

+ 1 - 1
models/user.go

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

+ 8 - 2
models/wiki.go

@@ -129,7 +129,10 @@ func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, mes
 	}
 	if err = git.AddChanges(localPath, true); err != nil {
 		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)
 	} else if err = git.Push(localPath, "origin", "master"); err != nil {
 		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 {
 		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)
 	} else if err = git.Push(localPath, "origin", "master"); err != nil {
 		return fmt.Errorf("Push: %v", err)

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.9.88.0827
+0.9.89.0827