mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Deals better with uncommitted commits
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Uri } from 'vscode';
|
import { Uri } from 'vscode';
|
||||||
import { DocumentSchemes } from '../constants';
|
import { DocumentSchemes } from '../constants';
|
||||||
import GitProvider from '../gitProvider';
|
import GitProvider, { Git } from '../gitProvider';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
export class GitUri extends Uri {
|
export class GitUri extends Uri {
|
||||||
|
|
||||||
@@ -26,14 +27,24 @@ export class GitUri extends Uri {
|
|||||||
base._fsPath = data.originalFileName || data.fileName;
|
base._fsPath = data.originalFileName || data.fileName;
|
||||||
|
|
||||||
this.offset = (data.decoration && data.decoration.split('\n').length) || 0;
|
this.offset = (data.decoration && data.decoration.split('\n').length) || 0;
|
||||||
this.repoPath = data.repoPath;
|
if (!Git.isUncommitted(data.sha)) {
|
||||||
this.sha = data.sha;
|
this.sha = data.sha;
|
||||||
|
this.repoPath = data.repoPath;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
base._fsPath = path.join(data.repoPath, base._fsPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (commit) {
|
else if (commit) {
|
||||||
base._fsPath = commit.originalFileName || commit.fileName;
|
base._fsPath = commit.originalFileName || commit.fileName;
|
||||||
|
|
||||||
this.repoPath = commit.repoPath;
|
if (!Git.isUncommitted(commit.sha)) {
|
||||||
this.sha = commit.sha;
|
this.sha = commit.sha;
|
||||||
|
this.repoPath = commit.repoPath;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
base._fsPath = path.join(commit.repoPath, base._fsPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user