Merge pull request #14971 from desktop/fix-unsafe-repos

Fix support for unsafe repositories
This commit is contained in:
Sergio Padrino 2022-07-18 13:12:51 +02:00 committed by GitHub
commit 1b1f45071b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -37,7 +37,7 @@ export async function getRepositoryType(path: string): Promise<RepositoryType> {
}
const unsafeMatch =
/fatal: detected dubious ownership in repository at '(.+)\' /.exec(
/fatal: detected dubious ownership in repository at '(.+)'/.exec(
result.stderr
)
if (unsafeMatch) {

View file

@ -101,5 +101,13 @@ describe('git/rev-parse', () => {
kind: 'missing',
})
})
it('returns unsafe for unsafe repository', async () => {
process.env['GIT_TEST_ASSUME_DIFFERENT_OWNER'] = '1'
expect(await getRepositoryType(repository.path)).toMatchObject({
kind: 'unsafe',
})
process.env['GIT_TEST_ASSUME_DIFFERENT_OWNER'] = undefined
})
})
})