Browse Source

Uses shortSha in git uris

main
Eric Amodio 7 years ago
parent
commit
0dda92cf8d
2 changed files with 6 additions and 5 deletions
  1. +4
    -3
      src/gitService.ts
  2. +2
    -2
      src/quickPicks/commitDetails.ts

+ 4
- 3
src/gitService.ts View File

@ -785,9 +785,9 @@ export class GitService extends Disposable {
return Git.isUncommitted(sha);
}
static toGitContentUri(sha: 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(shaOrcommit: string | GitCommit, fileName?: string, repoPath?: string, originalFileName?: string): Uri {
static toGitContentUri(shaOrcommit: string | GitCommit, shortSha?: string, fileName?: string, repoPath?: string, originalFileName?: string): Uri {
let data: IGitUriData;
if (typeof shaOrcommit === 'string') {
data = GitService._toGitUriData({
@ -800,10 +800,11 @@ export class GitService extends Disposable {
else {
data = GitService._toGitUriData(shaOrcommit, undefined, shaOrcommit.originalFileName);
fileName = shaOrcommit.fileName;
shortSha = shaOrcommit.shortSha;
}
const extension = path.extname(fileName);
return Uri.parse(`${DocumentSchemes.GitLensGit}:${path.basename(fileName, extension)}:${data.sha}${extension}?${JSON.stringify(data)}`);
return Uri.parse(`${DocumentSchemes.GitLensGit}:${path.basename(fileName, extension)}:${shortSha}${extension}?${JSON.stringify(data)}`);
}
static toReferenceGitContentUri(commit: GitCommit, index: number, commitCount: number, originalFileName?: string, decoration?: string): Uri {

+ 2
- 2
src/quickPicks/commitDetails.ts View File

@ -28,7 +28,7 @@ export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickI
? `${directory || ''} \u00a0\u2190\u00a0 ${status.originalFileName}`
: directory;
super(GitService.toGitContentUri(commit.sha, status.fileName, commit.repoPath, commit.originalFileName), {
super(GitService.toGitContentUri(commit.sha, commit.shortSha, status.fileName, commit.repoPath, commit.originalFileName), {
label: `\u00a0\u00a0\u00a0\u00a0${icon}\u00a0\u00a0 ${path.basename(status.fileName)}`,
description: description
});
@ -45,7 +45,7 @@ export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPi
constructor(commit: GitLogCommit, item?: QuickPickItem) {
const repoPath = commit.repoPath;
const uris = commit.fileStatuses.map(_ => GitService.toGitContentUri(commit.sha, _.fileName, repoPath, commit.originalFileName));
const uris = commit.fileStatuses.map(_ => GitService.toGitContentUri(commit.sha, commit.shortSha, _.fileName, repoPath, commit.originalFileName));
super(uris, item || {
label: `$(file-symlink-file) Open Changed Files`,
description: `\u00a0 \u2014 \u00a0\u00a0 in \u00a0$(git-commit) ${commit.shortSha}`

Loading…
Cancel
Save