diff options
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 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) } } |