From 0cf2f6ee1e62411f92fc5410c7c178273b0f57ce Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 12 Nov 2019 01:49:33 -0500 Subject: [PATCH] Returns first commit if ref cannot be found --- src/git/gitService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/git/gitService.ts b/src/git/gitService.ts index b891004..14012b6 100644 --- a/src/git/gitService.ts +++ b/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()