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

Function TestOdbWritepack

odb_test.go:159–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

157}
158
159func TestOdbWritepack(t *testing.T) {
160 t.Parallel()
161 repo := createTestRepo(t)
162 defer cleanupTestRepo(t, repo)
163
164 _, _ = seedTestRepo(t, repo)
165
166 odb, err := repo.Odb()
167 checkFatal(t, err)
168
169 var finalStats TransferProgress
170 writepack, err := odb.NewWritePack(func(stats TransferProgress) error {
171 finalStats = stats
172 return nil
173 })
174 checkFatal(t, err)
175 defer writepack.Free()
176
177 _, err = writepack.Write(outOfOrderPack)
178 checkFatal(t, err)
179 err = writepack.Commit()
180 checkFatal(t, err)
181
182 if finalStats.TotalObjects != 3 {
183 t.Errorf("mismatched transferred objects, expected 3, got %v", finalStats.TotalObjects)
184 }
185 if finalStats.ReceivedObjects != 3 {
186 t.Errorf("mismatched received objects, expected 3, got %v", finalStats.ReceivedObjects)
187 }
188 if finalStats.IndexedObjects != 3 {
189 t.Errorf("mismatched indexed objects, expected 3, got %v", finalStats.IndexedObjects)
190 }
191}
192
193func TestOdbBackendLoose(t *testing.T) {
194 t.Parallel()

Callers

nothing calls this directly

Calls 9

createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
seedTestRepoFunction · 0.85
checkFatalFunction · 0.85
OdbMethod · 0.80
NewWritePackMethod · 0.80
FreeMethod · 0.65
WriteMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…