(t *testing.T)
| 37 | } |
| 38 | |
| 39 | func 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 |
| 76 | func TestCloneWithExternalHTTPUrl(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…