MCPcopy Create free account
hub / github.com/Facets-cloud/flow / writeFakeGitConfig

Function writeFakeGitConfig

internal/app/workdir_test.go:13–30  ·  view source on GitHub ↗

writeFakeGitConfig creates a .git/config under dir with the given origin URL. Returns the absolute dir path.

(t *testing.T, dir, originURL string)

Source from the content-addressed store, hash-verified

11// writeFakeGitConfig creates a .git/config under dir with the given origin
12// URL. Returns the absolute dir path.
13func writeFakeGitConfig(t *testing.T, dir, originURL string) {
14 t.Helper()
15 gitDir := filepath.Join(dir, ".git")
16 if err := os.MkdirAll(gitDir, 0o755); err != nil {
17 t.Fatal(err)
18 }
19 cfg := `[core]
20 repositoryformatversion = 0
21[remote "origin"]
22 url = ` + originURL + `
23 fetch = +refs/heads/*:refs/remotes/origin/*
24[branch "main"]
25 remote = origin
26`
27 if err := os.WriteFile(filepath.Join(gitDir, "config"), []byte(cfg), 0o644); err != nil {
28 t.Fatal(err)
29 }
30}
31
32func TestCmdWorkdirAddManualName(t *testing.T) {
33 root := setupArchiveTestEnv(t)

Callers 5

TestCmdWorkdirScanNoAddFunction · 0.85
TestCmdWorkdirScanAddFunction · 0.85
TestDetectGitRemoteBasicFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected