diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2019-08-11 22:31:18 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-08-11 23:31:18 +0300 |
commit | e9bb75d8d18ba88dc26e4c4af6dc66812a9b8fb6 (patch) | |
tree | a4940d4ff3c8c16015a13be3c8540ec63565890b /modules/repofiles | |
parent | 8bfeb85f93ccd41289f901977243258e1b69f4d6 (diff) | |
download | gitea-e9bb75d8d18ba88dc26e4c4af6dc66812a9b8fb6.tar.gz gitea-e9bb75d8d18ba88dc26e4c4af6dc66812a9b8fb6.zip |
Fix duplicate call of webhook (#7821)
Diffstat (limited to 'modules/repofiles')
-rw-r--r-- | modules/repofiles/delete.go | 26 | ||||
-rw-r--r-- | modules/repofiles/update.go | 26 | ||||
-rw-r--r-- | modules/repofiles/upload.go | 27 |
3 files changed, 0 insertions, 79 deletions
diff --git a/modules/repofiles/delete.go b/modules/repofiles/delete.go index a8ab277b28..2210faae6b 100644 --- a/modules/repofiles/delete.go +++ b/modules/repofiles/delete.go @@ -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 diff --git a/modules/repofiles/update.go b/modules/repofiles/update.go index 26b5113f15..62e2afbc96 100644 --- a/modules/repofiles/update.go +++ b/modules/repofiles/update.go @@ -396,32 +396,6 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up return nil, err } - // Simulate push event. - oldCommitID := opts.LastCommitID - if opts.NewBranch != opts.OldBranch || oldCommitID == "" { - 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 diff --git a/modules/repofiles/upload.go b/modules/repofiles/upload.go index 2da101c64d..f2ffec7ebc 100644 --- a/modules/repofiles/upload.go +++ b/modules/repofiles/upload.go @@ -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...) } |