From 294b045d4b11bc52f54918996bed945d2bbd330d Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:10:07 +0100 Subject: [PATCH] Git - fix bug with comparing with a remote branch (#273705) * Git - fix bug with comparing with a remote branch * Update placeholder --- extensions/git/src/commands.ts | 6 +++--- extensions/git/src/git.ts | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 0fd7fe5e095..baab4069724 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -116,7 +116,7 @@ class RefItem implements QuickPickItem { case RefType.Head: return `refs/heads/${this.ref.name}`; case RefType.RemoteHead: - return `refs/remotes/${this.ref.remote}/${this.ref.name}`; + return `refs/remotes/${this.ref.name}`; case RefType.Tag: return `refs/tags/${this.ref.name}`; } @@ -5117,7 +5117,7 @@ export class CommandCenter { return itemsProcessor.processRefs(refs); }; - const placeHolder = l10n.t('Select a source reference to compare to'); + const placeHolder = l10n.t('Select a source reference to compare with'); const sourceRef = await this.pickRef(getRefPicks(), placeHolder); if (!(sourceRef instanceof BranchItem)) { @@ -5130,7 +5130,7 @@ export class CommandCenter { } try { - const changes = await repository.diffTrees(historyItemRef.id, sourceRef.refId); + const changes = await repository.diffTrees(sourceRef.refId, historyItemRef.id); if (changes.length === 0) { window.showInformationMessage(l10n.t('The selected references have no differences.')); diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index bb3685a53e4..98fbc032ef8 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -1730,6 +1730,8 @@ export class Repository { args.push(treeish2); } + args.push('--'); + const gitResult = await this.exec(args); if (gitResult.exitCode) { return [];