1
0
Fork 0
forked from forgejo/forgejo

Fix duplicate call of webhook (#7821)

This commit is contained in:
Antoine GIRARD 2019-08-11 22:31:18 +02:00 committed by Lauris BH
parent 8bfeb85f93
commit e9bb75d8d1
6 changed files with 34 additions and 113 deletions

View file

@ -178,32 +178,6 @@ func DeleteRepoFile(repo *models.Repository, doer *models.User, opts *DeleteRepo
return nil, err
}
// Simulate push event.
oldCommitID := opts.LastCommitID
if opts.NewBranch != opts.OldBranch {
oldCommitID = git.EmptySHA
}
if err = repo.GetOwner(); err != nil {
return nil, 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 nil, fmt.Errorf("PushUpdate: %v", err)
}
commit, err = t.GetCommit(commitHash)
if err != nil {
return nil, err