mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-29 01:25:42 -05:00
Adds content uri from GitUri
This commit is contained in:
@@ -1104,20 +1104,30 @@ export class GitService extends Disposable {
|
|||||||
|
|
||||||
static toGitContentUri(sha: string, shortSha: string, fileName: string, repoPath: string, originalFileName?: string): Uri;
|
static toGitContentUri(sha: string, shortSha: string, fileName: string, repoPath: string, originalFileName?: string): Uri;
|
||||||
static toGitContentUri(commit: GitCommit): Uri;
|
static toGitContentUri(commit: GitCommit): Uri;
|
||||||
static toGitContentUri(shaOrcommit: string | GitCommit, shortSha?: string, fileName?: string, repoPath?: string, originalFileName?: string): Uri {
|
static toGitContentUri(uri: GitUri): Uri;
|
||||||
|
static toGitContentUri(shaOrcommitOrUri: string | GitCommit | GitUri, shortSha?: string, fileName?: string, repoPath?: string, originalFileName?: string): Uri {
|
||||||
let data: IGitUriData;
|
let data: IGitUriData;
|
||||||
if (typeof shaOrcommit === 'string') {
|
if (typeof shaOrcommitOrUri === 'string') {
|
||||||
data = GitService._toGitUriData({
|
data = GitService._toGitUriData({
|
||||||
sha: shaOrcommit,
|
sha: shaOrcommitOrUri,
|
||||||
fileName: fileName!,
|
fileName: fileName!,
|
||||||
repoPath: repoPath!,
|
repoPath: repoPath!,
|
||||||
originalFileName: originalFileName
|
originalFileName: originalFileName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if (shaOrcommitOrUri instanceof GitCommit) {
|
||||||
|
data = GitService._toGitUriData(shaOrcommitOrUri, undefined, shaOrcommitOrUri.originalFileName);
|
||||||
|
fileName = shaOrcommitOrUri.fileName;
|
||||||
|
shortSha = shaOrcommitOrUri.shortSha;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
data = GitService._toGitUriData(shaOrcommit, undefined, shaOrcommit.originalFileName);
|
data = GitService._toGitUriData({
|
||||||
fileName = shaOrcommit.fileName;
|
sha: shaOrcommitOrUri.sha!,
|
||||||
shortSha = shaOrcommit.shortSha;
|
fileName: shaOrcommitOrUri.fsPath!,
|
||||||
|
repoPath: shaOrcommitOrUri.repoPath!
|
||||||
|
});
|
||||||
|
fileName = shaOrcommitOrUri.fsPath;
|
||||||
|
shortSha = shaOrcommitOrUri.shortSha;
|
||||||
}
|
}
|
||||||
|
|
||||||
const extension = path.extname(fileName!);
|
const extension = path.extname(fileName!);
|
||||||
|
|||||||
Reference in New Issue
Block a user