gitea: the seat git's branch with no branch named answers the repository's default branch (A-399)

The seed and a registration with no branches read the default branch through the seat git (design 47 G-1 §104) by
calling branch with an empty branch; gitea refused it as no branch for a path, and the seed stopped on novox 2026-11-14.
This commit is contained in:
2026-11-14 14:57:27 +01:00
parent 5df0fb64f5
commit 5236c2aa72
+4 -1
View File
@@ -152,7 +152,10 @@ export function seatTools(gitea: GiteaClient, deps: SeatDeps): ToolDefinition[]
verb(GIT_VERBS.branch, "The seat git's branch: a branch's head, and whether a protection rule refuses a direct push and admits only merges.",
async (args): Promise<BranchAnswer> => {
const { owner, repo, full } = repositoryOf(args.repository);
const branch = String(args.branch ?? "");
// No branch named is the repository's default branch, read from the forge, as the verb file reads it (A-399).
let branch = String(args.branch ?? "");
if (branch === "") branch = String((await gitea.getRepo(owner, repo)).default_branch ?? "");
if (branch === "") throw new Error(`the forge names no default branch of ${full}`);
// The head first: a branch the forge does not hold is its 404, the kind not-found, never an unprotected branch.
const head = await gitea.branchHead(owner, repo, branch);
return { repository: full, branch, head, protected: pushRefused(await gitea.appliedProtection(owner, repo, branch)) };