Skip to content

Commit 94adf83

Browse files
committed
Adds alternative wording check for unsafe repos
1 parent 82c024e commit 94adf83

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/env/node/git/git.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,12 +1400,14 @@ export class Git {
14001400
if (ex instanceof WorkspaceUntrustedError) return emptyArray as [];
14011401

14021402
const unsafeMatch =
1403-
/^fatal: detected dubious ownership in repository at '([^']+)'[\s\S]*git config --global --add safe\.directory '?([^'\n]+)'?$/m.exec(
1403+
/(?:^fatal: detected dubious ownership in repository at '([^']+)'|unsafe repository \('([^']+)' is owned by someone else\))[\s\S]*(git config --global --add safe\.directory [^\n]+)/m.exec(
14041404
ex.stderr,
14051405
);
1406-
if (unsafeMatch?.length === 3) {
1406+
if (unsafeMatch != null) {
14071407
Logger.log(
1408-
`Skipping; unsafe repository detected in '${unsafeMatch[1]}'; run 'git config --global --add safe.directory ${unsafeMatch[2]}' to allow it`,
1408+
`Skipping; unsafe repository detected in '${unsafeMatch[1] || unsafeMatch[2]}'; run '${
1409+
unsafeMatch[3]
1410+
}' to allow it`,
14091411
);
14101412
return [false];
14111413
}

0 commit comments

Comments
 (0)