MCPcopy Index your code
hub / github.com/code-pushup/cli / initGitRepo

Function initGitRepo

testing/test-utils/src/lib/utils/git.ts:13–28  ·  view source on GitHub ↗
(
  simpleGit: SimpleGitFactory,
  opt: {
    baseDir: string;
    config?: GitConfig;
    baseBranch?: string;
  },
)

Source from the content-addressed store, hash-verified

11export type GitConfig = { name: string; email: string };
12
13export async function initGitRepo(
14 simpleGit: SimpleGitFactory,
15 opt: {
16 baseDir: string;
17 config?: GitConfig;
18 baseBranch?: string;
19 },
20): Promise<SimpleGit> {
21 const { baseDir, baseBranch } = opt;
22 await mkdir(baseDir, { recursive: true });
23 const git = simpleGit(baseDir);
24 await git.init();
25 await git.branch(['-M', baseBranch ?? 'main']);
26 await configureGitUser(git, opt.config);
27 return git;
28}
29
30/** Like {@link initGitRepo}, but with a simulated remote origin. Working directory is `<baseDir>/repo`. */
31export async function initGitRepoWithRemote(

Callers 6

git.int.test.tsFile · 0.90
run.int.test.tsFile · 0.90
setupTestRepoFunction · 0.90

Calls 2

mkdirFunction · 0.85
configureGitUserFunction · 0.85

Tested by

no test coverage detected