Browse Source

Fixes diff with added files

main
Eric Amodio 4 years ago
parent
commit
2bdccf5cf1
2 changed files with 6 additions and 2 deletions
  1. +5
    -1
      src/commands/diffWith.ts
  2. +1
    -1
      src/git/gitService.ts

+ 5
- 1
src/commands/diffWith.ts View File

@ -103,11 +103,15 @@ export class DiffWithCommand extends Command {
args.rhs.uri.fsPath,
args.rhs.sha,
);
if (status != null && status.status === 'D') {
if (status?.status === 'D') {
args.rhs.sha = GitRevision.deletedOrMissing;
} else {
rhsSha = args.rhs.sha;
}
if (status?.status === 'A' && args.lhs.sha.endsWith('^')) {
args.lhs.sha = GitRevision.deletedOrMissing;
}
}
const [lhs, rhs] = await Promise.all([

+ 1
- 1
src/git/gitService.ts View File

@ -3161,7 +3161,7 @@ export class GitService implements Disposable {
: Strings.normalizePath(paths.relative(repoPath, fileNameOrUri.fsPath));
const blob = await Git.rev_parse__verify(repoPath, ref, fileName);
if (blob == null) return ref;
if (blob == null) return GitRevision.deletedOrMissing;
return (await Git.log__find_object(repoPath, blob, ref)) ?? ref;
}

Loading…
Cancel
Save