From 768508578518c7b5b9b3c212ed82b4818023dd69 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sat, 7 Sep 2019 01:03:07 -0400 Subject: [PATCH] Switches to workspace.fs --- src/git/models/repository.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/git/models/repository.ts b/src/git/models/repository.ts index 75b99b6..a551d9e 100644 --- a/src/git/models/repository.ts +++ b/src/git/models/repository.ts @@ -1,5 +1,4 @@ 'use strict'; -import * as fs from 'fs'; import * as paths from 'path'; import { commands, @@ -325,9 +324,12 @@ export class Repository implements Disposable { const hasRemotes = await this.hasRemotes(); if (!hasRemotes || Container.vsls.isMaybeGuest) return 0; - return new Promise((resolve, reject) => - fs.stat(paths.join(this.path, '.git/FETCH_HEAD'), (err, stat) => resolve(err ? 0 : stat.mtime.getTime())) - ); + try { + const stat = await workspace.fs.stat(Uri.file(paths.join(this.path, '.git/FETCH_HEAD'))); + return stat.mtime; + } catch { + return 0; + } } getRemotes(options: { sort?: boolean } = {}): Promise {