accept URLs with long Git tag refs

Extends `urlRegex` to accept tags specified with full `refs/tags/*` format.
Note the use of `?:` part to make the group not present in the `matche` list.

The need to reference Git tags with `refs/tags/` prefix is caused by
changes in how Nix `2.4` and newer versions handle Git tags. They expect
tags without full name to be branches, which fails with:
```
fatal: couldn't find remote ref refs/heads/v2.0.3-status-v6
error: program 'git' failed with exit code 128
```

Issue: https://github.com/status-im/status-react/issues/12832
PR: https://github.com/status-im/status-react/pull/12980

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-01-10 16:14:40 +01:00 committed by Jakub
parent 6aa243a0dc
commit 8e6e2152ba
1 changed files with 1 additions and 1 deletions

View File

@ -58,7 +58,7 @@ async function checkDependenciesAsync(
}
// tslint:disable-next-line:max-line-length
const urlRegex = /^(http:\/\/|https:\/\/|git\+http:\/\/|git\+https:\/\/|ssh:\/\/|git\+ssh:\/\/|github:)([a-zA-Z0-9_\-./]+)(#(.*))?$/gm
const urlRegex = /^(http:\/\/|https:\/\/|git\+http:\/\/|git\+https:\/\/|ssh:\/\/|git\+ssh:\/\/|github:)([a-zA-Z0-9_\-./]+)(#(?:refs\/tags\/)?(.*))?$/gm
const requiredProtocol = 'git+https://'
result.checkedDependencyCount += dependencies.length