From 34c3709cc6f89007ab52eed5d7b22eb690d8f222 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Thu, 2 Nov 2023 17:14:37 -0700 Subject: [PATCH] Fix getGitRevision mishandling HEAD file read Signed-off-by: Jeremy Ho --- app/src/components/utils.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/components/utils.ts b/app/src/components/utils.ts index 2efaf629..477ea9da 100644 --- a/app/src/components/utils.ts +++ b/app/src/components/utils.ts @@ -26,14 +26,13 @@ export function getGitRevision(): string { .toString() .trim(); - let fileRead: string = ''; if (head.indexOf(':') === -1) { - fileRead = readFileSync(join(__dirname, `${gitDir}/${head.substring(5)}`), 'utf8') + return head; + } else { + return readFileSync(join(__dirname, `${gitDir}/${head.substring(5)}`), 'utf8') .toString() .trim(); } - - return head.indexOf(':') === -1 ? head : (fileRead as string); // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (err: any) { log.warn(err.message, { function: 'getGitRevision' });