Browse Source

Fixes #2527 shows added files for Open All Changes

main
Keith Daulton 1 year ago
committed by Keith Daulton
parent
commit
af24943a41
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      src/git/actions/commit.ts

+ 7
- 5
src/git/actions/commit.ts View File

@ -202,8 +202,10 @@ export async function openChanges(
commitOrRefs: GitCommit | { repoPath: string; ref1: string; ref2: string },
options?: TextDocumentShowOptions,
) {
const isArgCommit = isCommit(commitOrRefs);
if (typeof file === 'string') {
if (!isCommit(commitOrRefs)) throw new Error('Invalid arguments');
if (!isArgCommit) throw new Error('Invalid arguments');
const f = await commitOrRefs.findFile(file);
if (f == null) throw new Error('Invalid arguments');
@ -213,17 +215,17 @@ export async function openChanges(
options = { preserveFocus: true, preview: false, ...options };
if (file.status === 'A') {
if (!isCommit(commitOrRefs)) return;
if (file.status === 'A' && isArgCommit) {
const commit = await commitOrRefs.getCommitForFile(file);
void executeCommand<DiffWithPreviousCommandArgs>(Commands.DiffWithPrevious, {
commit: commit,
showOptions: options,
});
return;
}
const refs = isCommit(commitOrRefs)
const refs = isArgCommit
? {
repoPath: commitOrRefs.repoPath,
// Don't need to worry about verifying the previous sha, as the DiffWith command will

Loading…
Cancel
Save