import { first } from "./db";
/**
* Repositories whose objects can hold pull requests headed in `headRepoId`: itself and, for a live fork, its
* parent. A pull request's head is always its base or a direct fork of it (see `findForkHead`), and the pull
* request lives in the base repository's object.
*/
export async function pullBaseRepoIds(headRepoId: string): Promise<string[]> {
const row = await first<{ fork_of_id: string | null }>("SELECT fork_of_id FROM repos WHERE id = ?", headRepoId);
return row?.fork_of_id ? [headRepoId, row.fork_of_id] : [headRepoId];
}