341
}
342
344
>
if (branch === 'main') {
345
return 0;
346
}
348
return 1;
349
}
351
>
}
352
353
export function getBranchCompletions(branches: readonly string[], options?: { readonly query?: string; readonly limit?: number }): string[] {
355
>
const filtered = normalizedQuery
356
? branches.filter(branch => branch.toLowerCase().includes(normalizedQuery))
357
: [...branches];
359
>
filtered.sort((a, b) => getCommonBranchPriority(a) - getCommonBranchPriority(b));
360
>
return options?.limit ? filtered.slice(0, options.limit) : filtered;
361
>
}