MCPcopy Index your code
hub / github.com/anomalyco/opencode / initRepo

Function initRepo

packages/core/test/project.test.ts:27–35  ·  view source on GitHub ↗
(dir: string, opts?: { commit?: boolean; remote?: string })

Source from the content-addressed store, hash-verified

25}
26
27async function initRepo(dir: string, opts?: { commit?: boolean; remote?: string }) {
28 await $`git init`.cwd(dir).quiet()
29 await $`git config core.fsmonitor false`.cwd(dir).quiet()
30 await $`git config commit.gpgsign false`.cwd(dir).quiet()
31 await $`git config user.email test@opencode.test`.cwd(dir).quiet()
32 await $`git config user.name Test`.cwd(dir).quiet()
33 if (opts?.commit) await $`git commit --allow-empty -m root`.cwd(dir).quiet()
34 if (opts?.remote) await $`git remote add origin ${opts.remote}`.cwd(dir).quiet()
35}
36
37async function rootCommit(dir: string) {
38 return (await $`git rev-list --max-parents=0 HEAD`.cwd(dir).text()).trim()

Callers 1

project.test.tsFile · 0.70

Calls 2

quietMethod · 0.80
cwdMethod · 0.65

Tested by

no test coverage detected