From b4608c9394d7a2ddfc6b14abb8dbe1182287b74c Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Wed, 4 Sep 2024 16:02:13 -0700 Subject: [PATCH] fix: resolve remote source actions by remote url (#227647) fix: resolve remote source actions by remote name --- extensions/git/src/commands.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index cb13cca654e..d80a203b5c3 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -525,9 +525,15 @@ class CheckoutItemsProcessor extends RefItemsProcessor { // Button(s) if (item.refRemote) { const matchingRemote = this.repository.remotes.find((remote) => remote.name === item.refRemote); - const remoteUrl = matchingRemote?.pushUrl ?? matchingRemote?.fetchUrl; - if (remoteUrl) { - item.buttons = this.buttons.get(item.refRemote); + const buttons = []; + if (matchingRemote?.pushUrl) { + buttons.push(...this.buttons.get(matchingRemote.pushUrl) ?? []); + } + if (matchingRemote?.fetchUrl && matchingRemote.fetchUrl !== matchingRemote.pushUrl) { + buttons.push(...this.buttons.get(matchingRemote.fetchUrl) ?? []); + } + if (buttons.length) { + item.buttons = buttons; } } else { item.buttons = this.defaultButtons;