Skip to content

Commit

Permalink
fix(admin): better git clean
Browse files Browse the repository at this point in the history
  • Loading branch information
lsagetlethias committed Jan 16, 2025
1 parent fc7f465 commit 7f37da6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/repo/impl/SimpleGitRepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ export class SimpleGitRepo implements IGitRepo {
private readonly seeddir = path.resolve("./db/seed");

constructor() {
this.git = this.prepareSimpleGit();
}

private prepareSimpleGit() {
if (!fs.existsSync(this.tmpdir)) {
fs.mkdirSync(this.tmpdir, { recursive: true });
}
this.git = simpleGit(this.tmpdir);
return simpleGit(this.tmpdir);
}

private async init(withPull = true): Promise<void> {
Expand Down Expand Up @@ -445,6 +449,10 @@ export class SimpleGitRepo implements IGitRepo {
throw new UnexpectedError("Failed to clean local repo");
}

this.configDone = false;
this.prepareSimpleGit();
await this.init();

return `${this.tmpdir} cleaned`;
}

Expand Down

0 comments on commit 7f37da6

Please sign in to comment.