Quellcode durchsuchen

Fixes issues showing uncommitted and staged content

main
Eric Amodio vor 6 Jahren
Ursprung
Commit
70ebec7b81
2 geänderte Dateien mit 13 neuen und 3 gelöschten Zeilen
  1. +2
    -2
      src/commands/diffWith.ts
  2. +11
    -1
      src/git/gitService.ts

+ 2
- 2
src/commands/diffWith.ts Datei anzeigen

@ -113,8 +113,8 @@ export class DiffWithCommand extends ActiveEditorCommand {
}
const [lhs, rhs] = await Promise.all([
Container.git.getVersionedFile(args.repoPath, args.lhs.uri.fsPath, args.lhs.sha),
Container.git.getVersionedFile(args.repoPath, args.rhs.uri.fsPath, args.rhs.sha)
Container.git.getVersionedUri(args.repoPath, args.lhs.uri.fsPath, args.lhs.sha),
Container.git.getVersionedUri(args.repoPath, args.rhs.uri.fsPath, args.rhs.sha)
]);
let rhsSuffix = GitService.shortenSha(rhsSha, { uncommitted: 'working tree' }) || '';

+ 11
- 1
src/git/gitService.ts Datei anzeigen

@ -1677,7 +1677,7 @@ export class GitService implements Disposable {
return GitTreeParser.parse(data) || [];
}
async getVersionedFile(
async getVersionedUri(
repoPath: string | undefined,
fileName: string,
ref: string | undefined
@ -1692,6 +1692,16 @@ export class GitService implements Disposable {
return undefined;
}
if (Git.isStagedUncommitted(ref)) {
const path = paths.resolve(repoPath || '', fileName);
return Uri.parse(
`git:${path}?${JSON.stringify({
path: path,
ref: '~'
})}`
);
}
return GitUri.toRevisionUri(ref, fileName, repoPath!);
}

Laden…
Abbrechen
Speichern