Skip to content

Commit 7513fa1

Browse files
authored
fix: accept hyphen in reponame regexp (#19)
1 parent 034481e commit 7513fa1

File tree

3 files changed

+29
-13
lines changed

3 files changed

+29
-13
lines changed

src/main/ts/chunks/git.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const getGitInfo: TVcsInfoCreator = (cwd = process.cwd()) => {
2525
: readFileToString(`${gitFolder}${sep}` + rev.slice('ref: '.length)).trim()
2626

2727
const repoUrlRegexp = /\turl = (.+)$/
28-
const repoNameRegexp = /\turl =.+[/:](\w+\/\w+).*$/
28+
const repoNameRegexp = /\turl =.+[/:]([\w-]+\/[\w-]+).*$/
2929

3030
const origin = readFileToString(`${gitFolder}${sep}config`)
3131
.split('\n')

src/test/ts/chunks/git.ts

+16
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ const testCases: TGitInfoTestCase[] = [
4040
repoUrl: /^undefined$/,
4141
commitId: '1234567890abcdef1234567890abcdef12345678',
4242
},
43+
{
44+
description: 'config contains gerrit url',
45+
head: 'rev: 1234567890abcdef1234567890abcdef12345678',
46+
config: '\turl = ssh://[email protected]:4242/foo/bar-baz-bat',
47+
repoName: 'foo/bar-baz-bat',
48+
repoUrl: /^ssh:\/\/d.abramov@gerrit.foo.ru:4242\/foo\/bar-baz-bat$/,
49+
commitId: '1234567890abcdef1234567890abcdef12345678',
50+
},
51+
{
52+
description: 'config contains url with kebab-named org',
53+
head: 'rev: 1234567890abcdef1234567890abcdef12345678',
54+
config: '\turl = ssh://[email protected]:4242/foo-qux/bar-baz-bat',
55+
repoName: 'foo-qux/bar-baz-bat',
56+
repoUrl: /^ssh:\/\/d.abramov@gerrit.foo.ru:4242\/foo-qux\/bar-baz-bat$/,
57+
commitId: '1234567890abcdef1234567890abcdef12345678',
58+
},
4359
]
4460

4561
afterAll(() => {

yarn.lock

+12-12
Original file line numberDiff line numberDiff line change
@@ -6031,9 +6031,9 @@ npm-run-path@^4.0.0:
60316031
path-key "^3.0.0"
60326032

60336033
npm-user-validate@~1.0.0:
6034-
version "1.0.0"
6035-
resolved "https://registry.yarnpkg.com/npm-user-validate/-/npm-user-validate-1.0.0.tgz#8ceca0f5cea04d4e93519ef72d0557a75122e951"
6036-
integrity sha1-jOyg9c6gTU6TUZ73LQVXp1Ei6VE=
6034+
version "1.0.1"
6035+
resolved "https://registry.yarnpkg.com/npm-user-validate/-/npm-user-validate-1.0.1.tgz#31428fc5475fe8416023f178c0ab47935ad8c561"
6036+
integrity sha512-uQwcd/tY+h1jnEaze6cdX/LrhWhoBxfSknxentoqmIuStxUExxjWd3ULMLFPiFUrZKbOVMowH6Jq2FRWfmhcEw==
60376037

60386038
npm@^6.13.0:
60396039
version "6.14.8"
@@ -6866,9 +6866,9 @@ query-string@^4.1.0:
68666866
strict-uri-encode "^1.0.0"
68676867

68686868
query-string@^6.8.2:
6869-
version "6.13.2"
6870-
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.2.tgz#3585aa9412c957cbd358fd5eaca7466f05586dda"
6871-
integrity sha512-BMmDaUiLDFU1hlM38jTFcRt7HYiGP/zt1sRzrIWm5zpeEuO1rkbPS0ELI3uehoLuuhHDCS8u8lhFN3fEN4JzPQ==
6869+
version "6.13.6"
6870+
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.6.tgz#e5ac7c74f2a5da43fbca0b883b4f0bafba439966"
6871+
integrity sha512-/WWZ7d9na6s2wMEGdVCVgKWE9Rt7nYyNIf7k8xmHXcesPMlEzicWo3lbYwHyA4wBktI2KrXxxZeACLbE84hvSQ==
68726872
dependencies:
68736873
decode-uri-component "^0.2.0"
68746874
split-on-first "^1.0.0"
@@ -8381,9 +8381,9 @@ typescript@^3.4:
83818381
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==
83828382

83838383
uglify-js@^3.1.4:
8384-
version "3.10.4"
8385-
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.10.4.tgz#dd680f5687bc0d7a93b14a3482d16db6eba2bfbb"
8386-
integrity sha512-kBFT3U4Dcj4/pJ52vfjCSfyLyvG9VYYuGYPmrPvAxRw/i7xHiT4VvCev+uiEMcEEiu6UNB6KgWmGtSUYIWScbw==
8384+
version "3.11.3"
8385+
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.11.3.tgz#b2f8c87826344f091ba48c417c499d6cba5d5786"
8386+
integrity sha512-wDRziHG94mNj2n3R864CvYw/+pc9y/RNImiTyrrf8BzgWn75JgFSwYvXrtZQMnMnOp/4UTrf3iCSQxSStPiByA==
83878387

83888388
83898389
version "0.0.6"
@@ -8541,9 +8541,9 @@ uuid@^3.3.2, uuid@^3.3.3:
85418541
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
85428542

85438543
uuid@^8.3.0:
8544-
version "8.3.0"
8545-
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.0.tgz#ab738085ca22dc9a8c92725e459b1d507df5d6ea"
8546-
integrity sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==
8544+
version "8.3.1"
8545+
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31"
8546+
integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==
85478547

85488548
v8-compile-cache@^2.0.3:
85498549
version "2.1.1"

0 commit comments

Comments
 (0)