fix: pin initial branch to master (#1740)

This commit is contained in:
Josh Soref 2021-01-20 14:20:48 -05:00 committed by GitHub
parent d2ec8931bc
commit 32a2c91d7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,8 +25,12 @@ const {GIT_NOTE_REF} = require('../../lib/definitions/constants');
*/
async function initGit(withRemote) {
const cwd = tempy.directory();
const args = withRemote ? ['--bare', '--initial-branch=master'] : ['--initial-branch=master'];
await execa('git', ['init', ...(withRemote ? ['--bare'] : [])], {cwd});
await execa('git', ['init', ...args], {cwd}).catch(() => {
const args = withRemote ? ['--bare'] : [];
return execa('git', ['init', ...args], {cwd});
});
const repositoryUrl = fileUrl(cwd);
return {cwd, repositoryUrl};
}