gitea/services/pull
Lunny Xiao 1463426a27
Use merge tree to detect conflicts when possible (#36400)
In Git 2.38, the `merge-tree` command introduced the `--write-tree`
option, which works directly on bare repositories. In Git 2.40, a new parameter `--merge-base` introduced so we require Git 2.40 to use the merge tree feature.

This option produces the merged tree object ID, allowing us to perform
diffs between commits without creating a temporary repository. By
avoiding the overhead of setting up and tearing down temporary repos,
this approach delivers a notable performance improvement.

It also fixes a possible situation that conflict files might be empty
but it's a conflict status according to
https://git-scm.com/docs/git-merge-tree#_mistakes_to_avoid

Replace #35542

---------

Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-27 11:57:20 -08:00
..
check.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
check_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
comment.go Fix review request webhook bug (#35339) (#35723) 2025-10-23 20:08:21 -07:00
commit_status.go Add ability to download subpath archive (#36371) 2026-01-16 09:31:12 +00:00
commit_status_test.go Fix required contexts and commit status matching bug (#34815) 2025-06-22 23:31:46 +00:00
edits.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
lfs.go Refactor git command stdio pipe (#36422) 2026-01-22 06:04:26 +00:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
merge.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
merge_ff_only.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
merge_merge.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
merge_prepare.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
merge_rebase.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
merge_squash.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
merge_test.go Always use an empty line to separate the commit message and trailer (#34512) 2025-06-02 06:29:16 +00:00
merge_tree.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
merge_tree_test.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
patch.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
patch_unmerged.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
protected_branch.go Use git model to detect whether branch exist instead of gitrepo method (#35459) 2025-10-25 10:08:25 -07:00
pull.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
pull_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
review.go Refactor GetRepoRawDiffForFile to avoid unnecessary pipe or goroutine (#36434) 2026-01-23 02:10:11 +00:00
review_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
reviewer.go Fix team permissions (#34827) 2025-06-24 21:24:09 +08:00
reviewer_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
temp_repo.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
update.go Fix various permission & login related bugs (#36002) 2025-11-22 07:16:08 +00:00
update_rebase.go Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00