diff options
author | evolvedlight <steve@evolvedlight.co.uk> | 2014-10-13 20:30:31 +0100 |
---|---|---|
committer | evolvedlight <steve@evolvedlight.co.uk> | 2014-10-13 20:30:31 +0100 |
commit | 8d2a6fc484b540819e211d52b8d54e97269f0918 (patch) | |
tree | e5bfe7d3937bb2d18ba2fb50ea72514bd5bb4e13 /models/action.go | |
parent | 29ac3980ffdb5faa525d77fddc109c9023ebe257 (diff) | |
parent | 89bd994c836ecc9b6ceb80849f470521e1b15917 (diff) |
Merge remote-tracking branch 'upstream/dev'
Conflicts:
models/repo.go
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/models/action.go b/models/action.go index 4203ead3..ef111e67 100644 --- a/models/action.go +++ b/models/action.go @@ -181,13 +181,19 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, commit = &base.PushCommits{} } - refName := git.RefEndName(refFullName) + repoLink := fmt.Sprintf("%s%s/%s", setting.AppUrl, repoUserName, repoName) + // if not the first commit, set the compareUrl + if !strings.HasPrefix(oldCommitId, "0000000") { + commit.CompareUrl = fmt.Sprintf("%s/compare/%s...%s", repoLink, oldCommitId, newCommitId) + } bs, err := json.Marshal(commit) if err != nil { return errors.New("action.CommitRepoAction(json): " + err.Error()) } + refName := git.RefEndName(refFullName) + // Change repository bare status and update last updated time. repo, err := GetRepositoryByName(repoUserId, repoName) if err != nil { @@ -211,7 +217,6 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, return errors.New("action.CommitRepoAction(NotifyWatchers): " + err.Error()) } - //qlog.Info("action.CommitRepoAction(end): %d/%s", repoUserId, repoName) // New push event hook. if err := repo.GetOwner(); err != nil { @@ -237,13 +242,6 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, return nil } - repoLink := fmt.Sprintf("%s%s/%s", setting.AppUrl, repoUserName, repoName) - compareUrl := "" - // if not the first commit, set the compareUrl - if !strings.HasPrefix(oldCommitId, "0000000") { - compareUrl = fmt.Sprintf("%s/compare/%s...%s", repoLink, oldCommitId, newCommitId) - } - pusher_email, pusher_name := "", "" pusher, err := GetUserByName(userName) if err == nil { @@ -293,7 +291,7 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, }, Before: oldCommitId, After: newCommitId, - CompareUrl: compareUrl, + CompareUrl: commit.CompareUrl, } for _, w := range ws { |