Skip to content

Commit

Permalink
chore: spliting if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
florianow committed Mar 13, 2024
1 parent e281d1c commit 773e2dd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/model/CollieHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ export class CollieHub {
const hasAlreadyCloned = await this.git.isRepo(hubCacheGitDir);
const collieHubVersion = this.config.getProperty("colliehubVersion");

if (!hasAlreadyCloned && !collieHubVersion) {
if (!hasAlreadyCloned) {
await this.git.clone(hubCacheDir, this.url);
}
if (!collieHubVersion) {
const latestTag = await this.git.getLatestTag(hubCacheDir);
await this.git.checkout(hubCacheDir, latestTag);
this.config.setProperty("colliehubVersion", latestTag);
} else if (collieHubVersion !== undefined) {
try {
await this.git.clone(hubCacheDir, this.url);
const latestTag = await this.git.getLatestTag(hubCacheDir);
if (latestTag !== collieHubVersion) {
throw new Error(`version tag ${collieHubVersion} not exist`);
Expand Down

0 comments on commit 773e2dd

Please sign in to comment.