GeezerVison is showing github.com — fix(shared): Bitbucket pull request links open their diff and commits… · CesarDavidXI/t3code-cd@c8ca292
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/shared/src/pullRequestAnchor.test.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,6 +10,7 @@ import { |
10 | 10 |
|
11 | 11 | const gitlab = "https://gitlab.com/group/repo/-/merge_requests/7"; |
12 | 12 | const forgejo = "https://codeberg.org/owner/repo/pulls/7"; |
| 13 | +const bitbucket = "https://bitbucket.org/workspace/repo/pull-requests/7"; |
13 | 14 |
|
14 | 15 | const url = "https://github.com/owner/repo/pull/7"; |
15 | 16 | it.each(["discussion_r123", "r123", "discussion-diff-123R5-L9", "discussion-diff-123"])( |
@@ -176,6 +177,8 @@ it.each([ |
176 | 177 | [`${url}/commits`, "commits"], |
177 | 178 | [`${url}/checks?check_run_id=1`, "checks"], |
178 | 179 | [`${forgejo}/files`, "code"], |
| 180 | + [`${bitbucket}/diff`, "code"], |
| 181 | + [`${bitbucket}/commits`, "commits"], |
179 | 182 | [`${gitlab}/diffs`, "code"], |
180 | 183 | [`${gitlab}/commits`, "commits"], |
181 | 184 | [`${gitlab}/pipelines`, "checks"], |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/shared/src/pullRequestAnchor.ts +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -39,14 +39,17 @@ function normalizePullRequestCommentAnchor(anchor: string): string { |
39 | 39 | } |
40 | 40 |
|
41 | 41 | // GitHub pull request tabs and their GitLab merge request equivalents. Forgejo and Gitea spell the |
42 | | -// path `/pulls/`. |
| 42 | +// path `/pulls/`; Bitbucket spells it `/pull-requests/` and its code tab `diff`. |
43 | 43 | function pullRequestPathTab(pathname: string): PullRequestAnchor | null { |
44 | | - const tab = /\/(?:pulls?|-\/merge_requests)\/\d+\/([a-z]+)(?:\/(.*))?$/i.exec(pathname); |
| 44 | + const tab = /\/(?:pulls?|pull-requests|-\/merge_requests)\/\d+\/([a-z]+)(?:\/(.*))?$/i.exec( |
| 45 | + pathname, |
| 46 | + ); |
45 | 47 | const rest = tab?.[2] ?? ""; |
46 | 48 | switch (tab?.[1]?.toLowerCase()) { |
47 | 49 | case "files": |
48 | 50 | case "changes": |
49 | 51 | case "diffs": |
| 52 | + case "diff": |
50 | 53 | return { kind: "code" }; |
51 | 54 | case "commits": |
52 | 55 | if (rest === "") return { kind: "commits" }; |
|