Skip to content

Commit 0560395

Browse files
committed
Fixes similarity threshold ignored in Git status
`getStatus` and `getStatusForPathCore` called `statusCore` without a similarity threshold, so `--find-renames` fell back to Git's default 50% instead of the configured `gitlens.advanced.similarityThreshold`. Forwards `context.config.commits.similarityThreshold` to both call sites. Regression from the standalone-packages refactor.
1 parent 45bce24 commit 0560395

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
4646
### Fixed
4747

4848
- Fixes opening the _Commit Graph_ in multi root workspace to the correct repo ([#5276](https://github.com/gitkraken/vscode-gitlens/issues/5276))
49+
- Fixes the `gitlens.advanced.similarityThreshold` setting being ignored when computing Git status — rename detection in status, working changes (WIP), and stash file lists used Git's default threshold (50%) instead of the configured value
4950
- Fixes the `gitlens.advanced.similarityThreshold` setting being ignored when listing changed files for a diff — rename detection used Git's default threshold (50%) instead of the configured value
5051
- Fixes force push from the _Push_ command always using `--force-with-lease` (and `--force-if-includes`) and ignoring VS Code's `git.useForcePushWithLease` and `git.useForcePushIfIncludes` settings — the confirmation could offer a plain `--force` while GitLens still pushed with lease; it now honors the configured preference
5152
- Fixes _Stash Unstaged Changes_ also stashing staged changes when an untracked file is involved — including untracked files no longer drops the `--keep-index` flag, so staged changes are correctly kept intact ([#5281](https://github.com/gitkraken/vscode-gitlens/issues/5281))

packages/git-cli/src/providers/status.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ export class StatusGitSubProvider implements GitStatusSubProvider {
4343

4444
const porcelainVersion = (await this.git.supports('git:status:porcelain-v2')) ? 2 : 1;
4545

46-
const result = await this.statusCore(repoPath, porcelainVersion, { priority: options?.priority }, cancellation);
46+
const result = await this.statusCore(
47+
repoPath,
48+
porcelainVersion,
49+
{
50+
similarityThreshold: this.context.config?.commits.similarityThreshold,
51+
priority: options?.priority,
52+
},
53+
cancellation,
54+
);
4755
const repoUri = fileUri(normalizePath(repoPath));
4856
const status = parseGitStatus(result.stdout, repoPath, porcelainVersion, p =>
4957
joinUriPath(repoUri, normalizePath(p)),
@@ -111,7 +119,7 @@ export class StatusGitSubProvider implements GitStatusSubProvider {
111119
const result = await this.statusCore(
112120
repoPath,
113121
porcelainVersion,
114-
{},
122+
{ similarityThreshold: this.context.config?.commits.similarityThreshold },
115123
cancellation,
116124
// If we want renames, don't include the path as Git won't do rename detection
117125
...(renames ? [] : [relativePath]),
@@ -135,7 +143,7 @@ export class StatusGitSubProvider implements GitStatusSubProvider {
135143
private async statusCore(
136144
repoPath: string,
137145
porcelainVersion: number = 1,
138-
options?: { similarityThreshold?: number; priority?: GitCommandPriority },
146+
options?: { similarityThreshold?: number | null; priority?: GitCommandPriority },
139147
cancellation?: AbortSignal,
140148
...pathspecs: string[]
141149
): Promise<GitResult> {

0 commit comments

Comments
 (0)