diff --git a/src/commands/diffLineWithPrevious.ts b/src/commands/diffLineWithPrevious.ts index 692356a..71e8c13 100644 --- a/src/commands/diffLineWithPrevious.ts +++ b/src/commands/diffLineWithPrevious.ts @@ -53,7 +53,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand { const diffArgs: DiffWithCommandArgs = { repoPath: args.commit.repoPath, lhs: { - sha: args.commit.previousSha !== undefined ? args.commit.previousSha : GitService.fakeSha, + sha: args.commit.previousSha !== undefined ? args.commit.previousSha : GitService.deletedSha, uri: args.commit.previousUri }, rhs: { diff --git a/src/commands/diffWith.ts b/src/commands/diffWith.ts index acb474c..fc6cf52 100644 --- a/src/commands/diffWith.ts +++ b/src/commands/diffWith.ts @@ -48,7 +48,7 @@ export class DiffWithCommand extends ActiveEditorCommand { args = { repoPath: commit1.repoPath, lhs: { - sha: commit1.previousSha !== undefined ? commit1.previousSha : GitService.fakeSha, + sha: commit1.previousSha !== undefined ? commit1.previousSha : GitService.deletedSha, uri: commit1.previousUri! }, rhs: { @@ -110,19 +110,19 @@ export class DiffWithCommand extends ActiveEditorCommand { if (rhs === undefined) { rhsPrefix = 'deleted in '; } - else if (lhs === undefined || args.lhs.sha === GitService.fakeSha) { + else if (lhs === undefined || args.lhs.sha === GitService.deletedSha) { rhsPrefix = 'added in '; } - if (args.lhs.title === undefined && lhs !== undefined && args.lhs.sha !== GitService.fakeSha) { + if (args.lhs.title === undefined && lhs !== undefined && args.lhs.sha !== GitService.deletedSha) { args.lhs.title = (args.lhs.sha === '' || GitService.isUncommitted(args.lhs.sha)) ? `${path.basename(args.lhs.uri.fsPath)}` : `${path.basename(args.lhs.uri.fsPath)} (${GitService.shortenSha(args.lhs.sha)})`; } - if (args.rhs.title === undefined && args.rhs.sha !== GitService.fakeSha) { + if (args.rhs.title === undefined && args.rhs.sha !== GitService.deletedSha) { args.rhs.title = (args.rhs.sha === '' || GitService.isUncommitted(args.rhs.sha)) - ? `${path.basename(args.rhs.uri.fsPath)}` - : `${path.basename(args.rhs.uri.fsPath)} (${rhsPrefix}${GitService.shortenSha(args.rhs.sha)})`; + ? `${path.basename(args.rhs.uri.fsPath)}` + : `${path.basename(args.rhs.uri.fsPath)} (${rhsPrefix}${GitService.shortenSha(args.rhs.sha)})`; } const title = (args.lhs.title !== undefined && args.rhs.title !== undefined) @@ -131,10 +131,10 @@ export class DiffWithCommand extends ActiveEditorCommand { return await commands.executeCommand(BuiltInCommands.Diff, lhs === undefined - ? GitService.toGitContentUri(GitService.fakeSha, args.lhs.uri.fsPath, args.repoPath) + ? GitService.toGitContentUri(GitService.deletedSha, args.lhs.uri.fsPath, args.repoPath) : Uri.file(lhs), rhs === undefined - ? GitService.toGitContentUri(GitService.fakeSha, args.rhs.uri.fsPath, args.repoPath) + ? GitService.toGitContentUri(GitService.deletedSha, args.rhs.uri.fsPath, args.repoPath) : Uri.file(rhs), title, args.showOptions); diff --git a/src/commands/diffWithPrevious.ts b/src/commands/diffWithPrevious.ts index 87a626e..299e2fd 100644 --- a/src/commands/diffWithPrevious.ts +++ b/src/commands/diffWithPrevious.ts @@ -38,7 +38,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand { try { const sha = args.commit === undefined ? gitUri.sha : args.commit.sha; - if (sha === GitService.fakeSha) return Messages.showCommitHasNoPreviousCommitWarningMessage(); + if (sha === GitService.deletedSha) return Messages.showCommitHasNoPreviousCommitWarningMessage(); const log = await this.git.getLogForFile(gitUri.repoPath, gitUri.fsPath, sha, { maxCount: 2, range: args.range!, skipMerges: true }); if (log === undefined) return Messages.showFileNotUnderSourceControlWarningMessage('Unable to open compare'); @@ -59,7 +59,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand { const diffArgs: DiffWithCommandArgs = { repoPath: args.commit.repoPath, lhs: { - sha: args.commit.previousSha !== undefined ? args.commit.previousSha : GitService.fakeSha, + sha: args.commit.previousSha !== undefined ? args.commit.previousSha : GitService.deletedSha, uri: args.commit.previousUri }, rhs: { diff --git a/src/gitContentProvider.ts b/src/gitContentProvider.ts index b4e5aad..3470cc0 100644 --- a/src/gitContentProvider.ts +++ b/src/gitContentProvider.ts @@ -16,7 +16,7 @@ export class GitContentProvider implements TextDocumentContentProvider { async provideTextDocumentContent(uri: Uri, token: CancellationToken): Promise { const data = GitService.fromGitContentUri(uri); - if (data.sha === GitService.fakeSha) return ''; + if (data.sha === GitService.deletedSha) return ''; const fileName = data.originalFileName || data.fileName; diff --git a/src/gitService.ts b/src/gitService.ts index 70a157b..ba98346 100644 --- a/src/gitService.ts +++ b/src/gitService.ts @@ -81,7 +81,7 @@ export interface GitChangeEvent { export class GitService extends Disposable { static emptyPromise: Promise = Promise.resolve(undefined); - static fakeSha = 'ffffffffffffffffffffffffffffffffffffffff'; + static deletedSha = 'ffffffffffffffffffffffffffffffffffffffff'; static uncommittedSha = '0000000000000000000000000000000000000000'; config: IConfig; diff --git a/src/views/gitExplorer.ts b/src/views/gitExplorer.ts index fc261c4..45c4919 100644 --- a/src/views/gitExplorer.ts +++ b/src/views/gitExplorer.ts @@ -342,7 +342,7 @@ export class GitExplorer implements TreeDataProvider { .map(s => GitUri.fromFileStatus(s, repoPath)); for (const uri of uris) { await this.openDiffWith(repoPath, - { uri: uri, sha: node.commit.previousSha !== undefined ? node.commit.previousSha : GitService.fakeSha }, + { uri: uri, sha: node.commit.previousSha !== undefined ? node.commit.previousSha : GitService.deletedSha }, { uri: uri, sha: node.commit.sha }, options); } }