Skip to content

Commit 583d6c9

Browse files
committed
Extract hash using arbitrary hash length
Fixes #2606
1 parent aef52ac commit 583d6c9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/git.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,16 @@ export const gitGenerators: Record<string, Fig.Generator> = {
126126
return [];
127127
}
128128

129-
return output.split("\n").map((line) => {
129+
const lines = output.split("\n");
130+
const firstLine = lines.length > 0 ? lines[0] : undefined;
131+
const hashLength = firstLine && firstLine.length > 0 ? firstLine.indexOf(' ') : 7;
132+
const descriptionStart = hashLength + 1;
133+
134+
return lines.map((line) => {
130135
return {
131-
name: line.substring(0, 7),
136+
name: line.substring(0, hashLength),
132137
icon: "fig://icon?type=node",
133-
description: line.substring(7),
138+
description: line.substring(descriptionStart),
134139
};
135140
});
136141
},

0 commit comments

Comments
 (0)