From 583d6c9c1a60a09520b4f05336eb64f7cf8b70e2 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sat, 9 Aug 2025 04:32:00 -0700 Subject: [PATCH 1/2] Extract hash using arbitrary hash length Fixes #2606 --- src/git.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/git.ts b/src/git.ts index eaf2b4179cb8..f6f30cf4db74 100644 --- a/src/git.ts +++ b/src/git.ts @@ -126,11 +126,16 @@ export const gitGenerators: Record = { return []; } - return output.split("\n").map((line) => { + const lines = output.split("\n"); + const firstLine = lines.length > 0 ? lines[0] : undefined; + const hashLength = firstLine && firstLine.length > 0 ? firstLine.indexOf(' ') : 7; + const descriptionStart = hashLength + 1; + + return lines.map((line) => { return { - name: line.substring(0, 7), + name: line.substring(0, hashLength), icon: "fig://icon?type=node", - description: line.substring(7), + description: line.substring(descriptionStart), }; }); }, From 79405adac96caa23cb2ff0c5a09093d369ce6731 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sat, 9 Aug 2025 04:36:33 -0700 Subject: [PATCH 2/2] Run prettier --- src/git.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/git.ts b/src/git.ts index f6f30cf4db74..29de7127db35 100644 --- a/src/git.ts +++ b/src/git.ts @@ -128,7 +128,8 @@ export const gitGenerators: Record = { const lines = output.split("\n"); const firstLine = lines.length > 0 ? lines[0] : undefined; - const hashLength = firstLine && firstLine.length > 0 ? firstLine.indexOf(' ') : 7; + const hashLength = + firstLine && firstLine.length > 0 ? firstLine.indexOf(" ") : 7; const descriptionStart = hashLength + 1; return lines.map((line) => {