build(integration): clone properly from the local repo when in a detached HEAD state
This commit is contained in:
@@ -40,7 +40,8 @@ const branch = execa.sync('git', [
|
||||
'HEAD'
|
||||
]).stdout;
|
||||
const repoInfo = {
|
||||
branch: branch === 'HEAD' ? 'master' : branch,
|
||||
// if local repo is in a detached HEAD state, providing --branch to `git clone` will fail.
|
||||
branch: branch === 'HEAD' ? '.' : branch,
|
||||
repo: process.cwd()
|
||||
};
|
||||
const buildDir = join(process.cwd(), 'build');
|
||||
|
||||
@@ -138,7 +138,7 @@ const mockErr = (code?: string | number) =>
|
||||
|
||||
test('cloneRepo: errors when Git is not installed on PATH', async t => {
|
||||
const error = await t.throws(
|
||||
cloneRepo(mockErr('ENOENT'))({ repo: 'r', branch: 'b' }, 'd', 'p')
|
||||
cloneRepo(mockErr('ENOENT'))({ repo: 'r', branch: '.' }, 'd', 'p')
|
||||
);
|
||||
t.regex(error.message, /Git is not installed on your PATH/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user