21 lines
618 B
TypeScript
21 lines
618 B
TypeScript
import type { Repo } from '../../shared/types'
|
|
import type { UsageScanWorktreeRef } from './usage-provider-contract'
|
|
|
|
export function createWorktreeRefs(
|
|
repos: Repo[],
|
|
worktreesByRepo: Map<string, { path: string; worktreeId: string; displayName: string }[]>
|
|
): UsageScanWorktreeRef[] {
|
|
const refs: UsageScanWorktreeRef[] = []
|
|
for (const repo of repos) {
|
|
for (const worktree of worktreesByRepo.get(repo.id) ?? []) {
|
|
refs.push({
|
|
repoId: repo.id,
|
|
worktreeId: worktree.worktreeId,
|
|
path: worktree.path,
|
|
displayName: worktree.displayName
|
|
})
|
|
}
|
|
}
|
|
return refs
|
|
}
|