дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +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
@@ -10,6 +10,7 @@ import {
|
||||
defaultBaseBranch,
|
||||
defaultDirection,
|
||||
generateTitle,
|
||||
headRepositories,
|
||||
headRefName,
|
||||
headText,
|
||||
needsPush,
|
||||
@@ -48,6 +49,23 @@ const branches = [
|
||||
];
|
||||
|
||||
describe("merge direction", () => {
|
||||
it("offers heads only on the base repository's host", () => {
|
||||
const ghe: GHRemote = { owner: "acme", name: "app", host: "ghe.example.com", remote: "origin", url: "" };
|
||||
const gheFork: GHRemote = { owner: "al", name: "app", host: "ghe.example.com", remote: "fork", url: "" };
|
||||
const dotcom: GHRemote = { owner: "acme", name: "app", host: "github.com", remote: "public", url: "" };
|
||||
expect(headRepositories([ghe, dotcom, gheFork], ghe)).toEqual([ghe, gheFork]);
|
||||
// The current branch tracks the github.com remote: the head stays on the Enterprise base.
|
||||
const tracking = [branch("feature", { current: true, upstream: "public/feature" }), remote("public/feature")];
|
||||
const d = defaultDirection({
|
||||
baseRepo: ghe,
|
||||
remotes: [ghe, dotcom, gheFork],
|
||||
branches: tracking,
|
||||
currentBranch: "feature",
|
||||
defaultBranch: "main",
|
||||
});
|
||||
expect(d.headRepo).toBe(ghe);
|
||||
});
|
||||
|
||||
it("splits remote branches by the longest remote name", () => {
|
||||
expect(splitRemoteBranch("origin/feat/x", ["origin"])).toEqual({ remote: "origin", name: "feat/x" });
|
||||
expect(splitRemoteBranch("my/fork/x", ["my", "my/fork"])).toEqual({ remote: "my/fork", name: "x" });
|
||||
|
||||
Reference in new issue
Заблокувати користувача