Git - pass the similarityThreshold to git diff-tree (#238367)
parent
3a459b0c14
commit
a0ecf511fd
|
@ -1592,8 +1592,14 @@ export class Repository {
|
|||
return parseGitChanges(this.repositoryRoot, gitResult.stdout);
|
||||
}
|
||||
|
||||
async diffTrees(treeish1: string, treeish2?: string): Promise<Change[]> {
|
||||
const args = ['diff-tree', '-r', '--name-status', '-z', '--diff-filter=ADMR', treeish1];
|
||||
async diffTrees(treeish1: string, treeish2?: string, options?: { similarityThreshold?: number }): Promise<Change[]> {
|
||||
const args = ['diff-tree', '-r', '--name-status', '-z', '--diff-filter=ADMR'];
|
||||
|
||||
if (options?.similarityThreshold) {
|
||||
args.push(`--find-renames=${options.similarityThreshold}%`);
|
||||
}
|
||||
|
||||
args.push(treeish1);
|
||||
|
||||
if (treeish2) {
|
||||
args.push(treeish2);
|
||||
|
|
|
@ -1166,7 +1166,10 @@ export class Repository implements Disposable {
|
|||
}
|
||||
|
||||
diffTrees(treeish1: string, treeish2?: string): Promise<Change[]> {
|
||||
return this.run(Operation.Diff, () => this.repository.diffTrees(treeish1, treeish2));
|
||||
const scopedConfig = workspace.getConfiguration('git', Uri.file(this.root));
|
||||
const similarityThreshold = scopedConfig.get<number>('similarityThreshold', 50);
|
||||
|
||||
return this.run(Operation.Diff, () => this.repository.diffTrees(treeish1, treeish2, { similarityThreshold }));
|
||||
}
|
||||
|
||||
getMergeBase(ref1: string, ref2: string, ...refs: string[]): Promise<string | undefined> {
|
||||
|
|
Loading…
Reference in New Issue