Skip to content

Commit

Permalink
fix(parseGitURI): support @ symbol in ref segment (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewvolk committed Mar 21, 2024
1 parent a61d394 commit 8128e33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function download(
}

const inputRegex =
/^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./-]+)?/;
/^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;

export function parseGitURI(input: string): GitInfo {
const m = input.match(inputRegex)?.groups || {};
Expand Down
1 change: 1 addition & 0 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe("parseGitURI", () => {
{ input: "org/repo#ref", output: { ref: "ref" } },
{ input: "org/repo#ref-123", output: { ref: "ref-123" } },
{ input: "org/repo#ref/ABC-123", output: { ref: "ref/ABC-123" } },
{ input: "org/repo#@org/tag@1.2.3", output: { ref: "@org/tag@1.2.3" } },
{ input: "org/repo/foo/bar", output: { subdir: "/foo/bar" } },
];

Expand Down

0 comments on commit 8128e33

Please sign in to comment.