MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / makeRepo

Function makeRepo

__tests__/git-status-subdir-project.test.ts:27–40  ·  view source on GitHub ↗
(prefix: string)

Source from the content-addressed store, hash-verified

25const CLEAN = { added: [], modified: [], removed: [] };
26
27function makeRepo(prefix: string): { repo: string; git: (...args: string[]) => string; write: (rel: string, body: string) => void } {
28 const repo = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), prefix)));
29 const git = (...args: string[]) =>
30 cp.execFileSync('git', args, { cwd: repo, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }) as string;
31 const write = (rel: string, body: string) => {
32 fs.mkdirSync(path.dirname(path.join(repo, rel)), { recursive: true });
33 fs.writeFileSync(path.join(repo, rel), body);
34 };
35 git('init', '-q');
36 git('config', 'user.email', 'test@example.invalid');
37 git('config', 'user.name', 'Test');
38 git('config', 'commit.gpgsign', 'false');
39 return { repo, git, write };
40}
41
42/** The `git status` runs made since the last clear, as [cwd, args]. */
43function gitStatusRuns(): Array<[string, string[]]> {

Calls 2

gitFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected