Fix force push time-line commit comments of pull request#36653
Fix force push time-line commit comments of pull request#36653lunny wants to merge 9 commits intogo-gitea:mainfrom
Conversation
|
"comments"? I think you mean "timeline entries", right? |
Yes. But it stored as comment in the database. |
|
Comment written by Claude Code (claude-opus-4-6) Some observations from reviewing this PR: 1. Raw DELETE bypasses The bulk delete at db.GetEngine(ctx).Where("issue_id = ?", pr.IssueID).
And("type = ?", issues_model.CommentTypePullRequestPush).
NoAutoCondition().
Delete(new(issues_model.Comment))The existing 2. The old code only called 3. Inconsistent use of Inside the transaction, the deletion guard uses the function parameter |
Oh ok, definitely a odd decision, but one that is probably hard to correct. We need to ensure comment-related logic stays intact. |
|
On more observation: When force-pushing over a single commit, it works as expected and the commit is replaced in the timeline, so I think that issue only showed when force-pushing over multiple commits. #36666 is a semi-related issue with incorrect status icon on force-pushed commits. |
I will send another PR to fix that issue after this merged. |
There was a problem hiding this comment.
Pull request overview
This PR addresses long-standing issues where force-pushing a PR branch leaves stale “pushed commits” entries in the PR timeline, by clearing prior push timeline comments on force-push and recreating the appropriate entries.
Changes:
- Update
CreatePushPullCommentto delete existing PR push-timeline comments on force-push, then recreate comments to reflect the new state. - Wrap force-push comment recreation in a DB transaction to keep deletion/recreation atomic.
- Add a unit test validating that force-push removes prior PR push-timeline comments.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
services/pull/comment.go |
Deletes old PR push comments on force-push and recreates timeline comments within a transaction. |
services/pull/comment_test.go |
Adds a test ensuring old PR push comments are removed when simulating a force-push. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: silverwind <me@silverwind.io>
|
@lunny let me know when this is ready, then I will test a few force-push scenarios. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
…nny/fix_force_push
It's ready to review again now. |
Fix #36647
Fix #25827
Fix #25870