All files / infrastructure/scripts/src/shared/adapters git.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12      4x       4x     4x  
import { join } from "node:path";
import { run } from "./exec.ts";
 
export const git = (...args: string[]): string => run("git", args);
 
let root: string | undefined;
 
export const repoRoot = (): string => (root ??= git("rev-parse", "--show-toplevel"));
 
/** pnpm may set cwd to this package, so repo-relative paths resolve from the actual Git root. */
export const at = (...parts: string[]): string => join(repoRoot(), ...parts);