Add git.DIFF_RENAME_SIMILARITY_THRESHOLD option (#36164)

Make the threshold value passed to `git diff --find-renames` configurable
This commit is contained in:
silverwind authored and GitHub committed 2025-12-17 10:02:32 +00:00
1 parent eaa47c3e09
commit 852bf5e2a5
5 files changed
+52 -32

No files matched your search

+4 -1
View File
@@ -15,6 +15,7 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/git/gitcmd"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
)
type DiffTree struct {
@@ -56,7 +57,9 @@ func runGitDiffTree(ctx context.Context, gitRepo *git.Repository, useMergeBase b
return nil, err
}
cmd := gitcmd.NewCommand("diff-tree", "--raw", "-r", "--find-renames", "--root")
cmd := gitcmd.NewCommand("diff-tree", "--raw", "-r", "--root").
AddOptionFormat("--find-renames=%s", setting.Git.DiffRenameSimilarityThreshold)
if useMergeBase {
cmd.AddArguments("--merge-base")
}