GeezerVison is showing github.com — fix(github): Enterprise Server pull request URLs can be pasted to che… · incognitojam/styal@40aba09
File tree
Expand file treeCollapse file tree
Open diff view settings
source-control-github/src/shared
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/client-runtime/src/pullRequestLinkInput.test.ts +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -173,6 +173,14 @@ describe("parsePullRequestReference", () => { |
173 | 173 | expect(parsePullRequestReference(url)).toBe(url); |
174 | 174 | }); |
175 | 175 |
|
| 176 | + it.each([ |
| 177 | + "https://github.acme.test/acme/web/pull/42", |
| 178 | + "https://git.corp.example/acme/web/pull/42/files?diff=split", |
| 179 | + ])("accepts GitHub Enterprise Server pull request URL %s", (url) => { |
| 180 | + expect(parsePullRequestReference(url)).toBe(url); |
| 181 | + expect(parsePullRequestReference(`gh pr checkout ${url}`)).toBe(url); |
| 182 | + }); |
| 183 | + |
176 | 184 | it("accepts gh pr checkout commands with raw numbers", () => { |
177 | 185 | expect(parsePullRequestReference("gh pr checkout 42")).toBe("42"); |
178 | 186 | }); |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/source-control-github/src/shared/definition.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,7 +19,7 @@ import { gitHubReferenceAutolinks } from "./referenceAutolinks.ts"; |
19 | 19 |
|
20 | 20 | const CHECKOUT_COMMAND = /^gh\s+pr\s+checkout\s+(.+)$/i; |
21 | 21 | const CHANGE_REQUEST_REFERENCE = |
22 | | - /^https:\/\/github\.com\/[^/\s]+\/[^/\s]+\/pull\/(\d+)(?:[/?#].*)?$/i; |
| 22 | + /^https?:\/\/[^/?#\s]+\/[^/\s]+\/[^/\s]+\/pull\/(\d+)(?:[/?#].*)?$/i; |
23 | 23 |
|
24 | 24 | // GitHub Enterprise Server runs on any hostname, so the `<owner>/<repo>/pull/<n>` route alone |
25 | 25 | // identifies a GitHub pull request. |
|