GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(shared): Bitbucket pull request links open their diff and commits… · pingdotgg/t3code@539ad91

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/shared/src
    • pullRequestAnchor.test.ts
    • pullRequestAnchor.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/shared/src/pullRequestAnchor.test.ts‎

Copy file name to clipboardExpand all lines: packages/shared/src/pullRequestAnchor.test.ts
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010

1111
const gitlab = "https://gitlab.com/group/repo/-/merge_requests/7";
1212
const forgejo = "https://codeberg.org/owner/repo/pulls/7";
13+
const bitbucket = "https://bitbucket.org/workspace/repo/pull-requests/7";
1314

1415
const url = "https://github.com/owner/repo/pull/7";
1516
it.each(["discussion_r123", "r123", "discussion-diff-123R5-L9", "discussion-diff-123"])(
@@ -156,6 +157,8 @@ it.each([
156157
[`${url}/commits`, "commits"],
157158
[`${url}/checks?check_run_id=1`, "checks"],
158159
[`${forgejo}/files`, "code"],
160+
[`${bitbucket}/diff`, "code"],
161+
[`${bitbucket}/commits`, "commits"],
159162
[`${gitlab}/diffs`, "code"],
160163
[`${gitlab}/commits`, "commits"],
161164
[`${gitlab}/pipelines`, "checks"],
Collapse file

‎packages/shared/src/pullRequestAnchor.ts‎

Copy file name to clipboardExpand all lines: packages/shared/src/pullRequestAnchor.ts
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,17 @@ function normalizePullRequestCommentAnchor(anchor: string): string {
4040
}
4141

4242
// GitHub pull request tabs and their GitLab merge request equivalents. Forgejo and Gitea spell the
43-
// path `/pulls/`.
43+
// path `/pulls/`; Bitbucket spells it `/pull-requests/` and its code tab `diff`.
4444
function pullRequestPathTab(pathname: string): PullRequestAnchor | null {
45-
const tab = /\/(?:pulls?|-\/merge_requests)\/\d+\/([a-z]+)(?:\/(.*))?$/i.exec(pathname);
45+
const tab = /\/(?:pulls?|pull-requests|-\/merge_requests)\/\d+\/([a-z]+)(?:\/(.*))?$/i.exec(
46+
pathname,
47+
);
4648
const rest = tab?.[2] ?? "";
4749
switch (tab?.[1]?.toLowerCase()) {
4850
case "files":
4951
case "changes":
5052
case "diffs":
53+
case "diff":
5154
return { kind: "code" };
5255
case "commits":
5356
if (rest === "") return { kind: "commits" };

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.