Skip to content

Commit

Permalink
Cleaner optional default branch implementation
Browse files Browse the repository at this point in the history
Co-authored-by: Sergio Padrino <sergio.padrino@gmail.com>
  • Loading branch information
tidy-dev and sergiou87 committed Mar 24, 2021
1 parent 2384d55 commit 1458c82
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions test/helpers.ts
Expand Up @@ -9,11 +9,8 @@ const temp = require('temp').track()

export async function initialize(repositoryName: string, defaultBranch?: string): Promise<string> {
const testRepoPath = temp.mkdirSync(`desktop-git-test-${repositoryName}`)
if (defaultBranch) {
await GitProcess.exec(['init', '-b', defaultBranch], testRepoPath)
} else {
await GitProcess.exec(['init'], testRepoPath)
}
const branchArgs = defaultBranch !== undefined ? ['-b', defaultBranch] : []
await GitProcess.exec(['init', ...branchArgs], testRepoPath)
await GitProcess.exec(['config', 'user.email', '"some.user@email.com"'], testRepoPath)
await GitProcess.exec(['config', 'user.name', '"Some User"'], testRepoPath)
return testRepoPath
Expand Down

0 comments on commit 1458c82

Please sign in to comment.