MCPcopy Index your code
hub / github.com/github/git-sizer / Next

Method Next

git/obj_head_iter.go:45–63  ·  view source on GitHub ↗

Next returns the key and value of the next header.

()

Source from the content-addressed store, hash-verified

43
44// Next returns the key and value of the next header.
45func (iter *ObjectHeaderIter) Next() (string, string, error) {
46 if len(iter.data) == 0 {
47 return "", "", fmt.Errorf("header for %s read past end", iter.name)
48 }
49 header := iter.data
50 keyEnd := strings.IndexByte(header, ' ')
51 if keyEnd == -1 {
52 return "", "", fmt.Errorf("malformed header in %s", iter.name)
53 }
54 key := header[:keyEnd]
55 header = header[keyEnd+1:]
56 valueEnd := strings.IndexByte(header, '\n')
57 if valueEnd == -1 {
58 return "", "", fmt.Errorf("malformed header in %s", iter.name)
59 }
60 value := header[:valueEnd]
61 iter.data = header[valueEnd+1:]
62 return key, value, nil
63}

Callers 2

ParseTagFunction · 0.95
ParseCommitFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected