git: pick index/HEAD ref later in the game

This commit is contained in:
Joao Moreno
2017-02-17 16:21:01 +01:00
parent 354059915b
commit 963bbca635
2 changed files with 11 additions and 9 deletions

View File

@@ -31,8 +31,17 @@ export class GitContentProvider {
}
async provideTextDocumentContent(uri: Uri): Promise<string> {
let ref = uri.query;
if (ref === '~') {
const fileUri = uri.with({ scheme: 'file', query: '' });
const uriString = fileUri.toString();
const [indexStatus] = this.model.indexGroup.resources.filter(r => r.original.toString() === uriString);
ref = indexStatus ? '' : 'HEAD';
}
try {
const result = await this.model.show(uri.query, uri);
const result = await this.model.show(ref, uri);
this.uris.add(uri);
return result;
} catch (err) {