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… · CesarDavidXI/t3code-cd@c8ca292

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"])(
@@ -176,6 +177,8 @@ it.each([
176177
[`${url}/commits`, "commits"],
177178
[`${url}/checks?check_run_id=1`, "checks"],
178179
[`${forgejo}/files`, "code"],
180+
[`${bitbucket}/diff`, "code"],
181+
[`${bitbucket}/commits`, "commits"],
179182
[`${gitlab}/diffs`, "code"],
180183
[`${gitlab}/commits`, "commits"],
181184
[`${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
@@ -39,14 +39,17 @@ function normalizePullRequestCommentAnchor(anchor: string): string {
3939
}
4040

4141
// 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`.
4343
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+
);
4547
const rest = tab?.[2] ?? "";
4648
switch (tab?.[1]?.toLowerCase()) {
4749
case "files":
4850
case "changes":
4951
case "diffs":
52+
case "diff":
5053
return { kind: "code" };
5154
case "commits":
5255
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.