INNER CODE UNIT · TypeScript
q
NVIDIA/NemoClaw · .dsh/tools/checkout_pr_for_local_repair/index.ts:44
const q = (v) => "'" + String(v).replaceAll("'", "'\"'\"'") + "'";
const branchCheck = await tools.bash({
command: "git check-ref-format --branch " + q(localBranch),
workdir: input.workdir,
description: "Validate local repair branch name",
timeoutMs: 10000,
});
if (branchCheck.kind !== "foreground" || branchCheck.exitCode !== 0)
throw new Error("localBranch is not a valid Git branch name");
const checkoutIdentity = await tools.read_git_checkout({
workdir: input.workdir,
includeRoot: false,
includeBranch: false,
includeStatus: true,
});
if (requireClean && !checkoutIdentity.clean)
throw new Error(
"Active checkout has uncommitted changes; use prepare_isolated_pr_worktree for concurrent work or clean this checkout first.",