Skip to content

Commit

Permalink
fix(version): reset git repository after version initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
neikvon committed Nov 27, 2020
1 parent bc4d93f commit 038ff3c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/core/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,16 @@ export class Version extends BaseClass {
version = { dir, long, short }
}

if (await this.fs.pathExists(version.dir)) {
await git.checkout(version.long, { cwd: version.dir })
await git.hardReset(version.long, { cwd: version.dir })
return version
}

if (!['master', 'main'].includes(version.short)) {
this.logItem(`Initializing version '${version.short}'...`)
await this.fs.copy(this.rootDir, version.dir)
await git.checkout(version.long, { cwd: version.dir })
if (!(await this.fs.pathExists(version.dir))) {
this.logItem(`Initializing version '${version.short}'...`)
await this.fs.copy(this.rootDir, version.dir)
}

await git.hardReset(version.long, { cwd: version.dir })
await git.checkout(version.long, { cwd: version.dir })
}

return version
}

Expand Down

0 comments on commit 038ff3c

Please sign in to comment.