Respect default branch setting when creating a new repository

This commit is contained in:
Sergio Padrino 2021-02-04 13:25:08 +01:00
parent 82d25b5035
commit 750c424684

View file

@ -1,6 +1,11 @@
import { getDefaultBranch } from '../helpers/default-branch'
import { git } from './core'
/** Init a new git repository in the given path. */
export async function initGitRepository(path: string): Promise<void> {
await git(['init'], path, 'initGitRepository')
await git(
['-c', `init.defaultBranch=${await getDefaultBranch()}`, 'init'],
path,
'initGitRepository'
)
}