fix: resolve remote source actions by remote url (#227647)

fix: resolve remote source actions by remote name
This commit is contained in:
Joyce Er
2024-09-04 16:02:13 -07:00
committed by GitHub
parent 747880f051
commit b4608c9394

View File

@@ -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;