瀏覽代碼

Returns first commit if ref cannot be found

main
Eric Amodio 5 年之前
父節點
當前提交
0cf2f6ee1e
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. +2
    -2
      src/git/gitService.ts

+ 2
- 2
src/git/gitService.ts 查看文件

@ -1234,10 +1234,10 @@ export class GitService implements Disposable {
const commit = options.ref && log.commits.get(options.ref);
if (commit === undefined && !options.firstIfNotFound && options.ref) {
// If the ref isn't a valid sha we will never find it, so let it fall through so we return the first
if (!Git.isSha(options.ref) || Git.isUncommitted(options.ref)) return undefined;
if (Git.isSha(options.ref) || Git.isUncommitted(options.ref)) return undefined;
}
return commit || Iterables.first(log.commits.values());
return commit ?? Iterables.first(log.commits.values());
}
@log()

Loading…
取消
儲存