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

Function gitRemote

packages/core/test/fixture/git.ts:10–30  ·  view source on GitHub ↗
(root: string)

Source from the content-addressed store, hash-verified

8const exec = promisify(execFile)
9
10export async function gitRemote(root: string) {
11 const origin = path.join(root, "origin.git")
12 const source = path.join(root, "source")
13 await git(root, "init", "--bare", origin)
14 await git(root, "init", source)
15 await git(source, "config", "user.email", "test@example.com")
16 await git(source, "config", "user.name", "Test")
17 await fs.writeFile(path.join(source, "README.md"), "one\n")
18 await git(source, "add", "README.md")
19 await git(source, "commit", "-m", "initial")
20 await git(source, "branch", "-M", "main")
21 await git(source, "remote", "add", "origin", pathToFileURL(origin).href)
22 await git(source, "push", "-u", "origin", "main")
23 await git(root, "--git-dir", origin, "symbolic-ref", "HEAD", "refs/heads/main")
24 return {
25 root,
26 source,
27 remote: pathToFileURL(origin).href,
28 reference: { ...Repository.parseRemote("owner/repo"), remote: pathToFileURL(origin).href },
29 }
30}
31
32export async function commit(source: string, content: string, message: string) {
33 await fs.writeFile(path.join(source, "README.md"), content)

Callers 2

withRemoteFunction · 0.90
withRemoteFunction · 0.90

Calls 1

gitFunction · 0.70

Tested by 2

withRemoteFunction · 0.72
withRemoteFunction · 0.72