INNER CODE UNIT · TypeScript

detectSlRepo

modem-dev/hunk · packages/hunk-sapling/src/index.ts:48

function detectSlRepo(cwd: string) {
  let current = resolve(cwd);
  for (;;) {
    if (fs.existsSync(join(current, ".sl"))) {
      return { id: "sl" as const, repoRoot: current };
    }
    const hgDir = join(current, ".hg");
    if (fs.existsSync(hgDir) && isSaplingHgRepo(hgDir)) {
      return { id: "sl" as const, repoRoot: current };
    }
    const parent = dirname(current);
    if (parent === current) {
      return null;
    }
    current = parent;
  }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…