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
2025-12-17 11:02:32 +01:00
committed by GitHub
parent eaa47c3e09
commit 852bf5e2a5
5 changed files with 52 additions and 32 deletions

View File

@@ -1225,8 +1225,9 @@ func getDiffBasic(ctx context.Context, gitRepo *git.Repository, opts *DiffOption
}
cmdDiff := gitcmd.NewCommand().
AddArguments("diff", "--src-prefix=\\a/", "--dst-prefix=\\b/", "-M").
AddArguments(opts.WhitespaceBehavior...)
AddArguments("diff", "--src-prefix=\\a/", "--dst-prefix=\\b/").
AddArguments(opts.WhitespaceBehavior...).
AddOptionFormat("--find-renames=%s", setting.Git.DiffRenameSimilarityThreshold)
// In git 2.31, git diff learned --skip-to which we can use to shortcut skip to file
// so if we are using at least this version of git we don't have to tell ParsePatch to do