MCPcopy Create free account
hub / github.com/libgit2/git2go / TestCloneWithCallback

Function TestCloneWithCallback

clone_test.go:39–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestCloneWithCallback(t *testing.T) {
40 t.Parallel()
41 testPayload := 0
42
43 repo := createTestRepo(t)
44 defer cleanupTestRepo(t, repo)
45
46 seedTestRepo(t, repo)
47
48 path, err := ioutil.TempDir("", "git2go")
49 checkFatal(t, err)
50
51 opts := CloneOptions{
52 Bare: true,
53 RemoteCreateCallback: func(r *Repository, name, url string) (*Remote, error) {
54 testPayload += 1
55 return r.Remotes.Create(REMOTENAME, url)
56 },
57 }
58
59 repo2, err := Clone(repo.Path(), path, &opts)
60 defer cleanupTestRepo(t, repo2)
61
62 checkFatal(t, err)
63
64 if testPayload != 1 {
65 t.Fatal("Payload's value has not been changed")
66 }
67
68 remote, err := repo2.Remotes.Lookup(REMOTENAME)
69 if err != nil || remote == nil {
70 t.Fatal("Remote was not created properly")
71 }
72 defer remote.Free()
73}
74
75// TestCloneWithExternalHTTPUrl
76func TestCloneWithExternalHTTPUrl(t *testing.T) {

Callers

nothing calls this directly

Calls 9

createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
seedTestRepoFunction · 0.85
checkFatalFunction · 0.85
CloneFunction · 0.85
FreeMethod · 0.65
CreateMethod · 0.45
PathMethod · 0.45
LookupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…