🐛 Only use bash shell for git init

This commit is contained in:
trickypr 2022-04-10 16:30:02 +10:00
parent 5bf2b5ac87
commit d0e6248fd2
2 changed files with 104 additions and 37 deletions

View file

@ -7,7 +7,7 @@ import Listr from 'listr'
import { resolve } from 'path'
import { bin_name } from '..'
import { log } from '../log'
import { config, dispatch } from '../utils'
import { config, configDispatch, dispatch } from '../utils'
export const init = async (
directory: Command | string,
@ -51,28 +51,48 @@ export const init = async (
// TODO: Use bash on windows, this may significantly improve performance. Still needs testing though
logInfo('Initializing git, this may take some time')
await dispatch('git', ['init'], dir as string, false, logInfo)
await dispatch(
'git',
['checkout', '--orphan', version],
dir as string,
false,
logInfo
)
await dispatch('git', ['add', '-f', '.'], dir as string, false, logInfo)
await configDispatch('git', {
args: ['init'],
cwd: dir,
logger: logInfo,
shell: 'unix',
})
await configDispatch('git', {
args: ['init'],
cwd: dir,
logger: logInfo,
shell: 'unix',
})
await configDispatch('git', {
args: ['checkout', '--orphan', version],
cwd: dir,
logger: logInfo,
shell: 'unix',
})
await configDispatch('git', {
args: ['add', '-f', '.'],
cwd: dir,
logger: logInfo,
shell: 'unix',
})
logInfo('Committing...')
await dispatch(
'git',
['commit', '-aqm', `"Firefox ${version}"`],
dir as string,
false,
logInfo
)
await dispatch(
'git',
['checkout', '-b', config.name.toLowerCase().replace(/\s/g, '_')],
dir as string,
false,
logInfo
)
await configDispatch('git', {
args: ['commit', '-aqm', `"Firefox ${version}"`],
cwd: dir,
logger: logInfo,
shell: 'unix',
})
await configDispatch('git', {
args: ['checkout', '-b', config.name.toLowerCase().replace(/\s/g, '_')],
cwd: dir,
logger: logInfo,
shell: 'unix',
})
}