gitea/services/repository
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
..
archiver Add ability to download subpath archive (#36371) 2026-01-16 09:31:12 +00:00
commitstatus Move some functions to gitrepo package (#35543) 2025-10-07 17:06:51 +08:00
files Refactor git command stdio pipe (#36422) 2026-01-22 06:04:26 +00:00
gitgraph Use merge tree to detect conflicts when possible (#36400) 2026-01-27 11:57:20 -08:00
adopt.go Some refactor for repo path (#36251) 2025-12-29 18:49:54 +00:00
adopt_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
avatar.go Fix avatar upload error handling (#35887) 2025-11-07 09:44:09 +08:00
avatar_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
branch.go Restrict branch naming when new change matches with protection rules (#36405) 2026-01-23 11:42:24 +01:00
cache.go Move commit related functions to gitrepo package (#35600) 2025-12-05 00:20:23 +00:00
check.go Refactor git command stderr handling (#36402) 2026-01-18 15:10:33 -08:00
collaboration.go Add more check for stopwatch read or list (#36340) 2026-01-13 13:13:39 +00:00
collaboration_test.go Add more check for stopwatch read or list (#36340) 2026-01-13 13:13:39 +00:00
commit.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
contributors_graph.go Refactor git command stdio pipe (#36422) 2026-01-22 06:04:26 +00:00
contributors_graph_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
create.go Refactor git command stderr handling (#36402) 2026-01-18 15:10:33 -08:00
create_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
delete.go Move HasWiki to repository service package (#33912) 2025-09-01 11:12:58 -07:00
delete_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
fork.go Move some functions to gitrepo package to reduce RepoPath reference directly (#36126) 2025-12-12 01:15:40 +01:00
fork_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
generate.go Use gitrepo's push function (#36245) 2025-12-28 13:24:28 +02:00
generate_test.go Fix various bugs (#36139) 2025-12-12 18:56:05 +00:00
hooks.go Move HasWiki to repository service package (#33912) 2025-09-01 11:12:58 -07:00
init.go Use gitrepo's push function (#36245) 2025-12-28 13:24:28 +02:00
lfs.go Use the database object format name but not read from git repoisitory everytime and fix possible migration wrong objectformat when migrating a sha256 repository (#29294) 2024-02-24 06:55:19 +00:00
lfs_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
license.go Only keep popular licenses (#33832) 2025-03-10 06:40:37 +08:00
license_test.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
merge_upstream.go Use gitrepo's clone and push when possible (#36093) 2025-12-10 09:41:01 -08:00
migrate.go Refactor git command stderr handling (#36402) 2026-01-18 15:10:33 -08:00
push.go Fix various bugs (#35177) 2025-07-30 07:08:59 +00:00
repo_team.go Use db.WithTx/WithTx2 instead of TxContext when possible (#35130) 2025-07-22 10:02:01 -07:00
repo_team_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
repository.go Fix missing repository id when migrating release attachments (#36389) 2026-01-20 10:05:51 -08:00
repository_test.go Fix missing repository id when migrating release attachments (#36389) 2026-01-20 10:05:51 -08:00
setting.go Use db.WithTx/WithTx2 instead of TxContext when possible (#35130) 2025-07-22 10:02:01 -07:00
template.go Move some functions from package git to gitrepo (#33910) 2025-09-01 19:13:18 +00:00
transfer.go Some refactor for repo path (#36251) 2025-12-29 18:49:54 +00:00
transfer_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00