From 7f37da672d67e022466c683137e2f6a3bf1e435c Mon Sep 17 00:00:00 2001 From: Lilian Saget-Lethias Date: Fri, 17 Jan 2025 00:00:26 +0100 Subject: [PATCH] fix(admin): better git clean --- src/lib/repo/impl/SimpleGitRepo.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/repo/impl/SimpleGitRepo.ts b/src/lib/repo/impl/SimpleGitRepo.ts index 95bc7a3..7b23ffe 100644 --- a/src/lib/repo/impl/SimpleGitRepo.ts +++ b/src/lib/repo/impl/SimpleGitRepo.ts @@ -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 { @@ -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`; }