fix GitUpdater maybe

This commit is contained in:
peter
2019-08-20 21:29:39 +02:00
parent e66b86c9ae
commit 3d234b24d9
+9 -6
View File
@@ -34,7 +34,7 @@ export type RepoFolderStatus = {
remote?: string
}
export class GitUpdater{
export class GitUpdater2{
private repo: git.SimpleGit
constructor(private readonly folderPath:string){
}
@@ -44,19 +44,22 @@ export class GitUpdater{
await fs.access(this.folderPath);
}
catch (e) {
try{
await gyt.gitDescribe(this.folderPath, { match: "*" });
}catch(e2){
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