Bläddra i källkod

Fixes #2527 shows added files for Open All Changes

main
Keith Daulton 1 år sedan
committed by Keith Daulton
förälder
incheckning
af24943a41
1 ändrade filer med 7 tillägg och 5 borttagningar
  1. +7
    -5
      src/git/actions/commit.ts

+ 7
- 5
src/git/actions/commit.ts Visa fil

@ -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

Laddar…
Avbryt
Spara