дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
fix(github): keep a new pull request's head on the base repository's host (#6746)
Follow-up to #6742. The new pull request form's head repository picker keyed its options by owner/name, so same-named repositories on an Enterprise server and on github.com could not both be picked, and it offered remotes on another host. It now lists only remotes on the base repository's host, keyed by host/owner/name, and the default head ignores a tracked remote on another host. A selection saved before #6742 (no host) now resolves to the origin remote's repository when that is one of the matches, instead of depending on remote order. Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
1 джерело
836a4405d6
коміт
9aa0718cf9
6 files changed
+79
-11
No files matched your search
@@ -100,6 +100,12 @@ export function trackedHead(
|
||||
return head.kind === "remote" ? head : upstreamOf(branches, head.name, remotes);
|
||||
}
|
||||
|
||||
/** The repositories a head can be in: the remotes on the base repository's host (forks there included). */
|
||||
export function headRepositories(remotes: readonly GHRemote[], base: GHRemote): GHRemote[] {
|
||||
const host = (r: GHRemote) => (r.host ?? "github.com").toLowerCase();
|
||||
return remotes.filter((r) => host(r) === host(base));
|
||||
}
|
||||
|
||||
/**
|
||||
* The default direction: base the default branch of the connected repository's remote,
|
||||
* head the current branch in the repository of its tracked remote (else the base one).
|
||||
@@ -114,7 +120,8 @@ export function defaultDirection(opts: {
|
||||
const { baseRepo, remotes, branches, currentBranch } = opts;
|
||||
const names = remotes.map((r) => r.remote);
|
||||
const tracked = currentBranch ? upstreamOf(branches, currentBranch, names) : null;
|
||||
const headRepo = (tracked && remotes.find((r) => r.remote === tracked.remote)) || baseRepo;
|
||||
const heads = headRepositories(remotes, baseRepo);
|
||||
const headRepo = (tracked && heads.find((r) => r.remote === tracked.remote)) || baseRepo;
|
||||
return {
|
||||
baseRepo,
|
||||
baseBranch: defaultBaseBranch(branches, baseRepo.remote, opts.defaultBranch),
|
||||
|
||||
Reference in new issue
Заблокувати користувача