summaryrefslogtreecommitdiffstats
path: root/models/update.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-03 01:37:49 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-03 01:37:49 -0400
commit7b60756f2c56314af715fa884388a5654bbfb791 (patch)
treeaab291357e23d6010e53dae80a51f66ed3294e20 /models/update.go
parente10096ee2e7985cfd73553f52b09994af025cd93 (diff)
downloadgitea-7b60756f2c56314af715fa884388a5654bbfb791.tar.gz
gitea-7b60756f2c56314af715fa884388a5654bbfb791.zip
Fix Collaborators cannot commit
Diffstat (limited to 'models/update.go')
-rw-r--r--models/update.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/models/update.go b/models/update.go
index 648c45f160..8aca15940e 100644
--- a/models/update.go
+++ b/models/update.go
@@ -16,14 +16,14 @@ import (
"github.com/gogits/gogs/modules/base"
)
-func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId int64) {
+func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName string, userId int64) {
isNew := strings.HasPrefix(oldCommitId, "0000000")
if isNew &&
strings.HasPrefix(newCommitId, "0000000") {
qlog.Fatal("old rev and new rev both 000000")
}
- f := RepoPath(userName, repoName)
+ f := RepoPath(repoUserName, repoName)
gitUpdate := exec.Command("git", "update-server-info")
gitUpdate.Dir = f
@@ -59,7 +59,12 @@ func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId
qlog.Fatalf("runUpdate.Commit repoId: %v", err)
}
- repos, err := GetRepositoryByName(userId, repoName)
+ ru, err := GetUserByName(repoUserName)
+ if err != nil {
+ qlog.Fatalf("runUpdate.GetUserByName: %v", err)
+ }
+
+ repos, err := GetRepositoryByName(ru.Id, repoName)
if err != nil {
qlog.Fatalf("runUpdate.GetRepositoryByName userId: %v", err)
}
@@ -83,8 +88,8 @@ func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId
}
//commits = append(commits, []string{lastCommit.Id().String(), lastCommit.Message()})
- if err = CommitRepoAction(userId, userName, actEmail,
- repos.Id, repoName, refName, &base.PushCommits{l.Len(), commits}); err != nil {
+ if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
+ repos.Id, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits}); err != nil {
qlog.Fatalf("runUpdate.models.CommitRepoAction: %v", err)
}
}