MCPcopy
hub / github.com/go-git/go-git / TestTreeFindEntryStopsAtUnsortedEntryPastName

Function TestTreeFindEntryStopsAtUnsortedEntryPastName

plumbing/object/tree_test.go:1974–1998  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1972}
1973
1974func TestTreeFindEntryStopsAtUnsortedEntryPastName(t *testing.T) {
1975 t.Parallel()
1976
1977 hashA := bytes.Repeat([]byte{0xAA}, 20)
1978 hashB := bytes.Repeat([]byte{0xBB}, 20)
1979 body := encodeRawTreeEntries(
1980 rawTreeEntry{"100644", "z", hashA},
1981 rawTreeEntry{"100644", "foo", hashB},
1982 )
1983
1984 obj := &plumbing.MemoryObject{}
1985 obj.SetType(plumbing.TreeObject)
1986 w, err := obj.Writer()
1987 require.NoError(t, err)
1988 _, err = w.Write(body)
1989 require.NoError(t, err)
1990 require.NoError(t, w.Close())
1991
1992 var tree Tree
1993 require.NoError(t, tree.Decode(obj))
1994
1995 got, err := tree.FindEntry("foo")
1996 require.ErrorIs(t, err, ErrEntryNotFound)
1997 assert.Nil(t, got)
1998}
1999
2000func TestTreeFindEntryFindsDirectoryAfterLexicallyEarlierFile(t *testing.T) {
2001 t.Parallel()

Callers

nothing calls this directly

Calls 7

SetTypeMethod · 0.95
WriterMethod · 0.95
DecodeMethod · 0.95
FindEntryMethod · 0.95
encodeRawTreeEntriesFunction · 0.85
CloseMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…