-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
triagedTeam has reviewed, verified, or reproduced thisTeam has reviewed, verified, or reproduced this
Description
The problem
due to origin being default remote, opening issue/PR on gitlens constantly opens the nonexistent link on fork.
this can be addressed by manually setting default remote to upstream in REMOTES pane, but it would be more ergonomic to do it automatically since forks have upstream remote.
Steps to reproduce
Prerequisites
- original repo and its issue: An issue in the upstream repo bbbchiv/2#1
- the fork, no issues: https://github.com/sergeibbb/2
- No default remote

- rich integration is OFF
- a commit linked to the original issue: sergeibbb/2@59f4cf9
Actual result
- autolink in a blame pop-up goes to
origin: - if a commit is linked to the PR it links to
originas well.
Explanation
It's in sorting.ts where origin goes earlier than upstream
export function sortRemotes<T extends GitRemote>(remotes: T[]): T[] {
return remotes.sort(
(a, b) =>
(a.default ? -1 : 1) - (b.default ? -1 : 1) ||
(a.name === 'origin' ? -1 : 1) - (b.name === 'origin' ? -1 : 1) ||
(a.name === 'upstream' ? -1 : 1) - (b.name === 'upstream' ? -1 : 1) ||
sortCompare(a.name, b.name),
);
}
Then it goes to hovers.ts where the first remote is taken:
remotes = remotesResult.value;
[remote] = remotes;
The proposal
Let user configure a default remote name that would go before origin. Or even let user configure a preferred sequence so it would work like: const preferredRemoteNames = getConfigured() ?? ['origin', 'upstream']
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
triagedTeam has reviewed, verified, or reproduced thisTeam has reviewed, verified, or reproduced this


