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

Function TestOdbHash

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

Source from the content-addressed store, hash-verified

92}
93
94func TestOdbHash(t *testing.T) {
95 t.Parallel()
96 repo := createTestRepo(t)
97 defer cleanupTestRepo(t, repo)
98
99 _, _ = seedTestRepo(t, repo)
100
101 odb, err := repo.Odb()
102 checkFatal(t, err)
103
104 str := `tree 115fcae49287c82eb55bb275cbbd4556fbed72b7
105parent 66e1c476199ebcd3e304659992233132c5a52c6c
106author John Doe <john@doe.com> 1390682018 +0000
107committer John Doe <john@doe.com> 1390682018 +0000
108
109Initial commit.`
110
111 for _, data := range [][]byte{[]byte(str), doublePointerBytes()} {
112 oid, err := odb.Hash(data, ObjectCommit)
113 checkFatal(t, err)
114
115 coid, err := odb.Write(data, ObjectCommit)
116 checkFatal(t, err)
117
118 if oid.Cmp(coid) != 0 {
119 t.Fatal("Hash and write Oids are different")
120 }
121 }
122}
123
124func TestOdbForeach(t *testing.T) {
125 t.Parallel()

Callers

nothing calls this directly

Calls 9

createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
seedTestRepoFunction · 0.85
checkFatalFunction · 0.85
doublePointerBytesFunction · 0.85
OdbMethod · 0.80
HashMethod · 0.80
WriteMethod · 0.45
CmpMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…