Skip to content

Commit cd6cef6

Browse files
committed
Fixes #4246
1 parent f8ce6d7 commit cd6cef6

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- Fixes Git diff of a renamed file is shown as a new file ([#4246](https://github.com/gitkraken/vscode-gitlens/issues/4246))
12+
913
## [17.5.1] - 2025-09-24
1014

1115
### Fixed

src/commands/diffWith.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ export class DiffWithCommand extends GlCommandBase {
146146
let lhsSuffix = shortenRevision(lhsResolved.revision);
147147
if (lhsResolved.sha === deletedOrMissing) {
148148
lhsSuffix = args.fromComparison ? `Missing${!lhsSuffix ? '' : ` in ${lhsSuffix}`}` : '';
149-
}
150-
if (lhs == null && !rhsResolved.sha) {
149+
} else if (lhs == null && !rhsResolved.sha) {
151150
if (rhs != null) {
152151
lhsSuffix = !lhsSuffix ? '' : `Not in ${lhsSuffix}`;
153152
rhsSuffix = '';

src/views/nodes/resultsFileNode.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,11 @@ export class ResultsFileNode extends ViewRefFileNode<'results-file', View, State
132132
if (this.direction === 'behind') {
133133
lhsUri = GitUri.fromFile(this.file, this.uri.repoPath!, this.ref2, true);
134134
rhsUri = this.uri;
135+
} else if (this.direction == null) {
136+
lhsUri = GitUri.fromFile(this.file, this.uri.repoPath!, this.ref1, true);
137+
rhsUri = GitUri.fromFile(this.file, this.uri.repoPath!, this.ref2, false);
135138
} else {
136-
if (this.direction == null) {
137-
lhsUri = GitUri.fromFile(this.file, this.uri.repoPath!, this.ref1, true);
138-
} else {
139-
lhsUri = this.uri;
140-
}
139+
lhsUri = this.uri;
141140
rhsUri = GitUri.fromFile(this.file, this.uri.repoPath!, this.ref2, true);
142141
}
143142
} else {

0 commit comments

Comments
 (0)