gitea/modules
Lunny Xiao f59d1d3cef
Fix the wrong push commits in the pull request when force push (#36914)
Fix #36905

The changes focus on force-push PR timeline handling and commit range
calculation:
- Reworked pull-request push comment creation to use a new
`gitrepo.GetCommitIDsBetweenReverse` helper, with special handling for
force pushes (merge-base based range, tolerate missing/invalid old
commits, and keep force-push timeline entries).
- Added `Comment.GetPushActionContent` to parse push comment payloads
and used it to delete only non-force-push push comments during force
pushes.
- Removed the old `Repository.CommitsBetweenNotBase` helper from
`modules/git/repo_commit.go` in favor of the new commit ID range helper.
- Added tests for `GetCommitIDsBetweenReverse` (normal range, `notRef`
filtering, fallback branch usage) and expanded pull comment tests to
cover force-push edge cases.

<img width="989" height="563" alt="image"
src="https://github.com/user-attachments/assets/a01e1bc2-fa8a-4028-8a35-d484e601ff3b"
/>

---------

Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-04-04 16:27:57 -07:00
..
actions Improve actions notifier for `workflow_run` (#37088) 2026-04-02 22:41:27 -07:00
analyze Fix incorrect vendored detections (#36508) 2026-02-01 10:35:51 +00:00
assetfs Fix theme discovery and Vite dev server in dev mode (#37033) 2026-03-30 14:59:10 +00:00
auth Update Go dependencies (#36781) 2026-04-01 11:26:52 +08:00
avatar Refactor avatar package, support default avatar fallback (#36788) 2026-03-01 13:32:35 +00:00
badge
base Fix incorrect setting loading order (#36735) 2026-02-24 23:46:08 +08:00
cache
cachegroup
charset Fix CodeQL code scanning alerts (#36858) 2026-03-08 14:35:50 +00:00
commitstatus Update Combine method to treat warnings as failures and adjust tests (#37048) 2026-03-31 17:22:18 +00:00
container
csv Disable Field count validation of CSV viewer (#35228) 2025-09-04 09:54:58 -07:00
dump Use github.com/mholt/archives replace github.com/mholt/archiver (#35390) 2025-09-01 19:40:12 +00:00
emoji Update emoji data for Unicode 16 (#36596) 2026-02-12 21:39:36 +00:00
eventsource Add more check for stopwatch read or list (#36340) 2026-01-13 13:13:39 +00:00
fileicon Add FOLDER_ICON_THEME configuration option (#36496) 2026-01-30 20:48:56 +00:00
generate Fix various bugs (#37096) 2026-04-03 20:03:59 +00:00
git Fix the wrong push commits in the pull request when force push (#36914) 2026-04-04 16:27:57 -07:00
gitrepo Fix the wrong push commits in the pull request when force push (#36914) 2026-04-04 16:27:57 -07:00
glob Replace gobwas/glob package (#35478) 2025-09-13 18:01:00 +00:00
globallock Upgrade golang to 1.25.1 and add descriptions for the swagger structs' fields (#35418) 2025-09-06 16:52:41 +00:00
graceful Migrate from webpack to vite (#37002) 2026-03-29 10:24:30 +00:00
gtprof
hcaptcha Clean up Makefile, tests and legacy code (#36638) 2026-02-19 01:23:32 +00:00
highlight Refactor code render and render control chars (#37078) 2026-04-02 21:10:01 -07:00
hostmatcher
htmlutil Fix markup heading parsing, fix emphasis parsing (#36284) 2026-01-23 20:24:58 +00:00
httpcache Refactor avatar package, support default avatar fallback (#36788) 2026-03-01 13:32:35 +00:00
httplib Pass ServeHeaderOptions by value instead of pointer, fine tune httplib tests (#36982) 2026-03-25 16:07:59 -07:00
indexer Fix typos in code comments: doesnt, dont, wont (#36890) 2026-03-13 09:58:44 -07:00
issue/template Limit reading bytes instead of ReadAll (#35928) 2025-11-12 19:44:49 +08:00
json Drop json-iterator dependency (#35544) 2025-09-28 22:30:28 +08:00
label
lfs Feature non-zipped actions artifacts (action v7) (#36786) 2026-03-26 00:37:48 +08:00
lfstransfer Correct spelling (#36783) 2026-02-28 11:23:20 -08:00
log Refactor git command context & pipeline (#36406) 2026-01-21 01:35:14 +00:00
markup Fix various bugs (#37096) 2026-04-03 20:03:59 +00:00
mcaptcha
metrics
migration Update Go dependencies (#36781) 2026-04-01 11:26:52 +08:00
nosql Refactor git command context & pipeline (#36406) 2026-01-21 01:35:14 +00:00
optional Fix API not persisting pull request unit config when has_pull_requests is not set (#36718) 2026-03-02 22:08:53 +00:00
options
packages Fix NuGet package upload error handling (#37074) 2026-04-01 23:54:14 +00:00
paginator
pprof
private feat: Add configurable permissions for Actions automatic tokens (#36173) 2026-03-21 15:39:47 -07:00
process Refactor git command context & pipeline (#36406) 2026-01-21 01:35:14 +00:00
proxy Replace gobwas/glob package (#35478) 2025-09-13 18:01:00 +00:00
proxyprotocol
public Fix theme discovery and Vite dev server in dev mode (#37033) 2026-03-30 14:59:10 +00:00
queue Refactor git command context & pipeline (#36406) 2026-01-21 01:35:14 +00:00
recaptcha Fix URLJoin, markup render link reoslving, sign-in/up/linkaccount page common data (#36861) 2026-03-08 15:57:37 +00:00
references Support closing keywords with URL references (#36221) 2025-12-27 09:05:24 -08:00
regexplru
repository feat: Add configurable permissions for Actions automatic tokens (#36173) 2026-03-21 15:39:47 -07:00
reqctx
secret
session Clean up Makefile, tests and legacy code (#36638) 2026-02-19 01:23:32 +00:00
setting Fix various bugs (#37096) 2026-04-03 20:03:59 +00:00
sitemap
ssh
storage Feature non-zipped actions artifacts (action v7) (#36786) 2026-03-26 00:37:48 +08:00
structs Add webhook name field to improve webhook identification (#37025) (#37040) 2026-04-01 09:56:20 +08:00
svg Add render cache for SVG icons (#36863) 2026-03-10 05:26:16 +00:00
system
tailmsg
tempdir Address some CodeQL security concerns (#35572) 2025-10-04 01:21:26 +08:00
templates Clean up AppURL, remove legacy origin-url webcomponent (#37090) 2026-04-03 17:56:31 +00:00
test Update golangci-lint to v2.11.4 (#37059) 2026-03-31 16:22:23 +00:00
testlogger Clean up Makefile, tests and legacy code (#36638) 2026-02-19 01:23:32 +00:00
timeutil Clean up Makefile, tests and legacy code (#36638) 2026-02-19 01:23:32 +00:00
translation Fix various trivial problems (#36953) 2026-03-23 18:23:42 +00:00
turnstile
typesniffer Feature non-zipped actions artifacts (action v7) (#36786) 2026-03-26 00:37:48 +08:00
updatechecker
uri
user
util Update golangci-lint to v2.11.4 (#37059) 2026-03-31 16:22:23 +00:00
validation Add user badges (#36752) 2026-03-22 15:49:45 +00:00
web Fix RPM Registry 404 when package name contains 'package' (#37087) 2026-04-03 06:12:04 +00:00
webhook actions: report commit status for pull_request_review events (#36589) 2026-02-20 16:12:22 +00:00
zstd