소스 검색

Fixes issue with diff files added in index/working tree

main
Eric Amodio 6 년 전
부모
커밋
f0c5df885f
3개의 변경된 파일11개의 추가작업 그리고 5개의 파일을 삭제
  1. +2
    -1
      src/commands/diffWith.ts
  2. +2
    -0
      src/git/git.ts
  3. +7
    -4
      src/git/gitService.ts

+ 2
- 1
src/commands/diffWith.ts 파일 보기

@ -108,7 +108,8 @@ export class DiffWithCommand extends ActiveEditorCommand {
if (args.lhs.sha !== GitService.deletedOrMissingSha) {
lhsSha = args.lhs.sha;
}
if (args.rhs.sha !== GitService.deletedOrMissingSha) {
if (args.rhs.sha && args.rhs.sha !== GitService.deletedOrMissingSha) {
// Ensure that the file still exists in this commit
const status = await Container.git.getFileStatusForCommit(
args.repoPath,

+ 2
- 0
src/git/git.ts 파일 보기

@ -511,6 +511,8 @@ export class Git {
}
static async cat_file_validate(repoPath: string, fileName: string, ref: string) {
if (Git.isUncommitted(ref)) return ref;
try {
await git<string>(
{ cwd: repoPath, exceptionHandler: throwExceptionHandler },

+ 7
- 4
src/git/gitService.ts 파일 보기

@ -1850,14 +1850,17 @@ export class GitService implements Disposable {
}
async resolveReference(repoPath: string, ref: string, uri?: Uri) {
if (Git.isSha(ref) || !Git.isShaLike(ref) || ref.endsWith('^3')) return ref;
Logger.log(`resolveReference('${repoPath}', '${ref}', '${uri && uri.toString(true)}')`);
if (uri == null) return (await Git.revparse(repoPath, ref)) || ref;
const resolved = Git.isSha(ref) || !Git.isShaLike(ref) || ref.endsWith('^3');
if (uri == null) return resolved ? ref : (await Git.revparse(repoPath, ref)) || ref;
const fileName = Strings.normalizePath(paths.relative(repoPath, uri.fsPath));
const resolvedRef = await Git.log_resolve(repoPath, fileName, ref);
let resolvedRef;
if (!resolved) {
resolvedRef = await Git.log_resolve(repoPath, fileName, ref);
}
const ensuredRef = await Git.cat_file_validate(repoPath, fileName, resolvedRef || ref);
if (ensuredRef === undefined) return ref;

불러오는 중...
취소
저장