mirror of https://github.com/go-gitea/gitea.git
some improvements
This commit is contained in:
parent
7c98b643b8
commit
6c44844222
|
@ -104,7 +104,7 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
|
|||
return
|
||||
}
|
||||
|
||||
results := generateCompareLinks(ctx, opts, ownerName, repoName, wasEmpty)
|
||||
results := generateBranchResults(ctx, opts, repo, ownerName, repoName, wasEmpty)
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
@ -229,9 +229,8 @@ func handlePushOptions(ctx *gitea_context.PrivateContext, opts *private.HookOpti
|
|||
}
|
||||
}
|
||||
|
||||
func generateCompareLinks(ctx *gitea_context.PrivateContext, opts *private.HookOptions, ownerName, repoName string, wasEmpty bool) []private.HookPostReceiveBranchResult {
|
||||
func generateBranchResults(ctx *gitea_context.PrivateContext, opts *private.HookOptions, repo *repo_model.Repository, ownerName, repoName string, wasEmpty bool) []private.HookPostReceiveBranchResult {
|
||||
results := make([]private.HookPostReceiveBranchResult, 0, len(opts.OldCommitIDs))
|
||||
var repo *repo_model.Repository
|
||||
var baseRepo *repo_model.Repository
|
||||
|
||||
// Now handle the pull request notification trailers
|
||||
|
@ -240,7 +239,10 @@ func generateCompareLinks(ctx *gitea_context.PrivateContext, opts *private.HookO
|
|||
newCommitID := opts.NewCommitIDs[i]
|
||||
|
||||
// If we've pushed a branch (and not deleted it)
|
||||
if !git.IsEmptyCommitID(newCommitID) && refFullName.IsBranch() {
|
||||
if !refFullName.IsBranch() || git.IsEmptyCommitID(newCommitID) {
|
||||
continue
|
||||
}
|
||||
|
||||
// First ensure we have the repository loaded, we're allowed pulls requests and we can get the base repo
|
||||
if repo == nil {
|
||||
repo = loadRepository(ctx, ownerName, repoName)
|
||||
|
@ -311,7 +313,6 @@ func generateCompareLinks(ctx *gitea_context.PrivateContext, opts *private.HookO
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue