Browse Source

Fixes new files not showing a diff

main
Keith Daulton 2 years ago
parent
commit
4ce3a8f66b
2 changed files with 12 additions and 1 deletions
  1. +10
    -1
      src/commands/gitCommands.actions.ts
  2. +2
    -0
      src/webviews/apps/commitDetails/commitDetails.ts

+ 10
- 1
src/commands/gitCommands.actions.ts View File

@ -3,6 +3,7 @@ import { env, Range, Uri, window } from 'vscode';
import type {
BrowseRepoAtRevisionCommandArgs,
DiffWithCommandArgs,
DiffWithPreviousCommandArgs,
DiffWithWorkingCommandArgs,
GitCommandsCommandArgs,
OpenFileOnRemoteCommandArgs,
@ -371,7 +372,15 @@ export namespace GitActions {
file = f;
}
if (file.status === 'A') return;
if (file.status === 'A') {
if (!isCommit(commitOrRefs)) return;
const commit = await commitOrRefs.getCommitForFile(file);
void executeCommand<DiffWithPreviousCommandArgs>(Commands.DiffWithPrevious, {
commit: commit,
showOptions: options,
});
}
const refs = isCommit(commitOrRefs)
? {

+ 2
- 0
src/webviews/apps/commitDetails/commitDetails.ts View File

@ -382,6 +382,7 @@ export class CommitDetailsApp extends App> {
level="${level}"
${stashAttr}
path="${item.value.path}"
repo="${item.value.repoPath}"
icon="${item.value.icon.dark}"
status="${item.value.status}"
></file-change-list-item>
@ -400,6 +401,7 @@ export class CommitDetailsApp extends App> {
<file-change-list-item
${stashAttr}
path="${file.path}"
repo="${file.repoPath}"
icon="${file.icon.dark}"
status="${file.status}"
></file-change-list-item>

Loading…
Cancel
Save