Skip to content

Commit 8764f15

Browse files
HarshitOnGitHublunny
authored andcommitted
branch: Trigger update when deleting branch via UI. (#5617)
Fixes: #5309.
1 parent 4c52858 commit 8764f15

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

routers/repo/branch.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,19 @@ func deleteBranch(ctx *context.Context, branchName string) error {
126126
return err
127127
}
128128

129-
// Don't return error here
129+
// Don't return error below this
130+
if err := models.PushUpdate(branchName, models.PushUpdateOptions{
131+
RefFullName: git.BranchPrefix + branchName,
132+
OldCommitID: commit.ID.String(),
133+
NewCommitID: git.EmptySHA,
134+
PusherID: ctx.User.ID,
135+
PusherName: ctx.User.Name,
136+
RepoUserName: ctx.Repo.Owner.Name,
137+
RepoName: ctx.Repo.Repository.Name,
138+
}); err != nil {
139+
log.Error(4, "Update: %v", err)
140+
}
141+
130142
if err := ctx.Repo.Repository.AddDeletedBranch(branchName, commit.ID.String(), ctx.User.ID); err != nil {
131143
log.Warn("AddDeletedBranch: %v", err)
132144
}

0 commit comments

Comments
 (0)