`TestGitDiffTreeRespectsDiffOrderFile` fails on git older than 2.46,
such as the 2.43 that Ubuntu 24.04 ships, even though Gitea supports git
2.34 and newer. Its `GlobalDiffOrderFile` subtest sets and removes the
global `diff.orderFile` with `git config set` and `git config unset`,
which were added in git 2.46, so older git stops it at the first call
with `exit status 129 - usage: git config [<options>]`.
The test now uses `git config --global` and `git config --global
--unset`, the classic syntax that `modules/git/config.go` also uses.
With git 2.34.1 and 2.43.0 the test failed before and passes now; git
2.56.1 passes either way.
Follow-up to https://github.com/go-gitea/gitea/pull/38566
Assisted-by: Hermes Agent:claude-opus-5-5
`parseGitDiffTreeLine` (`services/gitdiff/git_diff_tree.go`) read
`BasePath`/`HeadPath` straight from `git diff-tree --raw` output without
undoing git's C-quoting, unlike its sibling `parseLsTreeLine`
(`modules/git/parse.go`), which already does this with
`strconv.Unquote`.
This fix applies the same unquoting to both paths in the diff-tree
parser.
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Unfortunately, we can't completely remove the ctx from git.Repository,
because the CatFileBatch still heavily depends on a parent context.
If we remove the Repository ctx, the CatFileBatch will become a mess and
create a lot of unnecessary git processes.
http://localhost:3000/-/admin/monitor/perftrace
* Before: open a repo home, dozens of git processes (duplicate cat-file)
* After: only a few (no duplicate cat-file)
* Implemented calling git diff-tree
* Ensures wrapper function is called with valid arguments
* Parses output into go struct, using strong typing when possible