Fixes #59 - Updates command context to opened file state

Removes insiders restriction from Open in Remote commands
This commit is contained in:
Eric Amodio
2017-04-08 15:07:22 -04:00
parent b70ffbdeee
commit 7cb1b9d0f1
9 changed files with 244 additions and 216 deletions

View File

@@ -13,9 +13,9 @@ import * as ignore from 'ignore';
import * as moment from 'moment';
import * as path from 'path';
export { getGitStatusIcon } from './git/git';
export { Git, GitUri };
export { GitUri };
export * from './git/git';
export * from './git/gitContextTracker';
class UriCacheEntry {
@@ -296,12 +296,14 @@ export class GitService extends Disposable {
}
}
public getBlameability(fileName: string): boolean {
if (!this.UseGitCaching) return true;
public async getBlameability(uri: GitUri): Promise<boolean> {
if (!this.UseGitCaching) return await this.isTracked(uri);
const cacheKey = this.getCacheEntryKey(fileName);
const cacheKey = this.getCacheEntryKey(uri.fsPath);
const entry = this._gitCache.get(cacheKey);
return !(entry && entry.hasErrors);
if (!entry) return await this.isTracked(uri);
return !entry.hasErrors;
}
async getBlameForFile(uri: GitUri): Promise<IGitBlame | undefined> {
@@ -752,6 +754,13 @@ export class GitService extends Disposable {
return !!status;
}
async isTracked(uri: GitUri): Promise<boolean> {
Logger.log(`isFileUncommitted('${uri.repoPath}', '${uri.fsPath}')`);
const result = await Git.ls_files(uri.repoPath, uri.fsPath);
return !!result;
}
openDirectoryDiff(repoPath: string, sha1: string, sha2?: string) {
Logger.log(`openDirectoryDiff('${repoPath}', ${sha1}, ${sha2})`);