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

Function TestIsNote

reference_test.go:183–215  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

181}
182
183func TestIsNote(t *testing.T) {
184 t.Parallel()
185 repo := createTestRepo(t)
186 defer cleanupTestRepo(t, repo)
187
188 commitID, _ := seedTestRepo(t, repo)
189
190 sig := &Signature{
191 Name: "Rand Om Hacker",
192 Email: "random@hacker.com",
193 When: time.Now(),
194 }
195
196 refname, err := repo.Notes.DefaultRef()
197 checkFatal(t, err)
198
199 _, err = repo.Notes.Create(refname, sig, sig, commitID, "This is a note", false)
200 checkFatal(t, err)
201
202 ref, err := repo.References.Lookup(refname)
203 checkFatal(t, err)
204
205 if !ref.IsNote() {
206 t.Fatalf("%s should be a note", ref.Name())
207 }
208
209 ref, err = repo.References.Create("refs/heads/foo", commitID, true, "")
210 checkFatal(t, err)
211
212 if ref.IsNote() {
213 t.Fatalf("%s should not be a note", ref.Name())
214 }
215}
216
217func TestReferenceNameIsValid(t *testing.T) {
218 t.Parallel()

Callers

nothing calls this directly

Calls 9

createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
seedTestRepoFunction · 0.85
checkFatalFunction · 0.85
DefaultRefMethod · 0.80
IsNoteMethod · 0.80
CreateMethod · 0.45
LookupMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…