瀏覽代碼

Optimizes performance of git-log

main
Eric Amodio 7 年之前
父節點
當前提交
4a88edd5ca
共有 2 個檔案被更改,包括 4 行新增3 行删除
  1. +3
    -2
      src/commands/diffWithPrevious.ts
  2. +1
    -1
      src/commands/diffWithWorking.ts

+ 3
- 2
src/commands/diffWithPrevious.ts 查看文件

@ -41,10 +41,11 @@ export default class DiffWithPreviousCommand extends EditorCommand {
}
}
const log = await this.git.getLogForFile(gitUri.fsPath, undefined, gitUri.repoPath, rangeOrLine as Range);
const sha = (commit && commit.sha) || gitUri.sha;
const log = await this.git.getLogForFile(gitUri.fsPath, undefined, gitUri.repoPath, rangeOrLine as Range, sha ? undefined : 2);
if (!log) return window.showWarningMessage(`Unable to open diff. File is probably not under source control`);
const sha = (commit && commit.sha) || gitUri.sha;
commit = (sha && log.commits.get(sha)) || Iterables.first(log.commits.values());
}
catch (ex) {

+ 1
- 1
src/commands/diffWithWorking.ts 查看文件

@ -27,7 +27,7 @@ export default class DiffWithWorkingCommand extends EditorCommand {
const gitUri = GitUri.fromUri(uri, this.git);
try {
const log = await this.git.getLogForFile(gitUri.fsPath, gitUri.sha, gitUri.repoPath);
const log = await this.git.getLogForFile(gitUri.fsPath, gitUri.sha, gitUri.repoPath, undefined, gitUri.sha ? undefined : 1);
if (!log) return window.showWarningMessage(`Unable to open diff. File is probably not under source control`);
commit = (gitUri.sha && log.commits.get(gitUri.sha)) || Iterables.first(log.commits.values());

Loading…
取消
儲存