INNER CODE UNIT · TypeScript
detectJjRepo
modem-dev/hunk · packages/hunk-jj/src/index.ts:47
function detectJjRepo(cwd: string) {
let current = resolve(cwd);
for (;;) {
if (fs.existsSync(join(current, ".jj"))) {
return { id: "jj" as const, repoRoot: current };
}
const parent = dirname(current);
if (parent === current) {
return null;
}
current = parent;
}
}
/* -------------------------------------------------------------------------- */
/* Exact file sources */
/* -------------------------------------------------------------------------- */