diff options
author | Unknown <joe2010xtmf@163.com> | 2014-05-03 01:38:22 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-05-03 01:38:22 -0400 |
commit | bb0bc0a240acf745001c1cb3f0f64c8fb8ab696b (patch) | |
tree | 1c01cccd2fab6896017c1a90f5551d2eda2d0439 /models/update.go | |
parent | 163fcec59fd110db9edd459a06671962d48d87fa (diff) | |
parent | 7b60756f2c56314af715fa884388a5654bbfb791 (diff) | |
download | gitea-bb0bc0a240acf745001c1cb3f0f64c8fb8ab696b.tar.gz gitea-bb0bc0a240acf745001c1cb3f0f64c8fb8ab696b.zip |
Merge branch 'dev' of github.com:gogits/gogs
Diffstat (limited to 'models/update.go')
-rw-r--r-- | models/update.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/models/update.go b/models/update.go index 75bcc1d487..3ae5510a84 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 @@ -65,7 +65,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) } @@ -89,8 +94,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) } } |