diff --git a/src/backend/GitUpdater.ts b/src/backend/GitUpdater.ts index 0f0a410..d1d645c 100644 --- a/src/backend/GitUpdater.ts +++ b/src/backend/GitUpdater.ts @@ -34,29 +34,32 @@ export type RepoFolderStatus = { remote?: string } -export class GitUpdater{ +export class GitUpdater2{ private repo: git.SimpleGit constructor(private readonly folderPath:string){ } async getStatus():Promise{ try { - await fs.access(this.folderPath); + await fs.access(this.folderPath); } catch (e) { - try{ - await gyt.gitDescribe(this.folderPath, { match: "*" }); - }catch(e2){ - return { exists: false, empty: true, isRepo: false }; - } + return { exists: false, empty: true, isRepo: false }; + } + + const files = await fs.readdir(this.folderPath) + const empty:boolean = files.length === 0 + + try{ + await fs.access(this.folderPath+"/.git"); + }catch(e2){ + return { exists: true, empty: empty, isRepo: false }; } if(!this.repo){ this.repo = git(this.folderPath) } - const files = await fs.readdir(this.folderPath) - const empty:boolean = files.length === 0 await this.repo.fetch("origin", "master", { "--tags": null @@ -108,4 +111,4 @@ export class GitUpdater{ await this.repo.checkout(tag); return await this.getStatus(); } -} \ No newline at end of file +}