Переглянути джерело

Renames fakeSha to deletedSha

main
Eric Amodio 7 роки тому
джерело
коміт
e05239499a
6 змінених файлів з 14 додано та 14 видалено
  1. +1
    -1
      src/commands/diffLineWithPrevious.ts
  2. +8
    -8
      src/commands/diffWith.ts
  3. +2
    -2
      src/commands/diffWithPrevious.ts
  4. +1
    -1
      src/gitContentProvider.ts
  5. +1
    -1
      src/gitService.ts
  6. +1
    -1
      src/views/gitExplorer.ts

+ 1
- 1
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: {

+ 8
- 8
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);

+ 2
- 2
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: {

+ 1
- 1
src/gitContentProvider.ts Переглянути файл

@ -16,7 +16,7 @@ export class GitContentProvider implements TextDocumentContentProvider {
async provideTextDocumentContent(uri: Uri, token: CancellationToken): Promise<string | undefined> {
const data = GitService.fromGitContentUri(uri);
if (data.sha === GitService.fakeSha) return '';
if (data.sha === GitService.deletedSha) return '';
const fileName = data.originalFileName || data.fileName;

+ 1
- 1
src/gitService.ts Переглянути файл

@ -81,7 +81,7 @@ export interface GitChangeEvent {
export class GitService extends Disposable {
static emptyPromise: Promise<GitBlame | GitDiff | GitLog | undefined> = Promise.resolve(undefined);
static fakeSha = 'ffffffffffffffffffffffffffffffffffffffff';
static deletedSha = 'ffffffffffffffffffffffffffffffffffffffff';
static uncommittedSha = '0000000000000000000000000000000000000000';
config: IConfig;

+ 1
- 1
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);
}
}

Завантаження…
Відмінити
Зберегти