diff --git a/src/git/git.ts b/src/git/git.ts index 98627fa..f4e296d 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -834,16 +834,20 @@ export namespace Git { params.push('--all'); } - params.push(renames && startLine == null && all !== true ? '--follow' : '-m'); - - if (filters != null && filters.length !== 0) { - params.push(`--diff-filter=${filters.join(emptyStr)}`); + // Can't allow rename detection (`--follow`) if `all` or a `startLine` is specified + if (renames && (all || startLine != null)) { + renames = false; } - if ((all !== true && renames) || firstParent) { + params.push(renames ? '--follow' : '-m'); + if (/*renames ||*/ firstParent) { params.push('--first-parent'); } + if (filters != null && filters.length !== 0) { + params.push(`--diff-filter=${filters.join(emptyStr)}`); + } + if (format !== 'refs') { if (startLine == null) { if (format === 'simple') { diff --git a/src/git/gitService.ts b/src/git/gitService.ts index ee92576..bc31753 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -2189,6 +2189,7 @@ export class GitService implements Disposable { const data = await Git.log__file(root, file, ref, { ...options, + firstParent: options.renames, startLine: range == null ? undefined : range.start.line + 1, endLine: range == null ? undefined : range.end.line + 1, });