Skip to content

Commit

Permalink
fix: allow / in git refs (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-genesis committed Oct 4, 2023
1 parent 5ea5d96 commit 8eb4b26
Show file tree
Hide file tree
Showing 2 changed files with 3 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
2 changes: 2 additions & 0 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ describe("parseGitURI", () => {
const tests = [
{ input: "org/repo", output: {} },
{ 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/foo/bar", output: { subdir: "/foo/bar" } },
];

Expand Down

0 comments on commit 8eb4b26

Please sign in to comment.