Skip to content

Commit

Permalink
Returns first commit if ref cannot be found
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Nov 12, 2019
1 parent a2a7c60 commit 0cf2f6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/git/gitService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0cf2f6e

Please sign in to comment.