forked from forgejo/forgejo
Fix duplicate call of webhook (#7821)
This commit is contained in:
parent
8bfeb85f93
commit
e9bb75d8d1
6 changed files with 34 additions and 113 deletions
|
@ -11,7 +11,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/lfs"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
)
|
||||
|
@ -177,31 +176,5 @@ func UploadRepoFiles(repo *models.Repository, doer *models.User, opts *UploadRep
|
|||
return err
|
||||
}
|
||||
|
||||
// Simulate push event.
|
||||
oldCommitID := opts.LastCommitID
|
||||
if opts.NewBranch != opts.OldBranch {
|
||||
oldCommitID = git.EmptySHA
|
||||
}
|
||||
|
||||
if err = repo.GetOwner(); err != nil {
|
||||
return fmt.Errorf("GetOwner: %v", err)
|
||||
}
|
||||
err = PushUpdate(
|
||||
repo,
|
||||
opts.NewBranch,
|
||||
models.PushUpdateOptions{
|
||||
PusherID: doer.ID,
|
||||
PusherName: doer.Name,
|
||||
RepoUserName: repo.Owner.Name,
|
||||
RepoName: repo.Name,
|
||||
RefFullName: git.BranchPrefix + opts.NewBranch,
|
||||
OldCommitID: oldCommitID,
|
||||
NewCommitID: commitHash,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("PushUpdate: %v", err)
|
||||
}
|
||||
|
||||
return models.DeleteUploads(uploads...)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue