MCPcopy Create free account
hub / github.com/go-git/go-git / processLine

Method processLine

storage/filesystem/dotgit/dotgit.go:925–943  ·  view source on GitHub ↗

process lines from a packed-refs file

(line string)

Source from the content-addressed store, hash-verified

923
924// process lines from a packed-refs file
925func (d *DotGit) processLine(line string) (*plumbing.Reference, error) {
926 if len(line) == 0 {
927 return nil, nil
928 }
929
930 switch line[0] {
931 case '#': // comment - ignore
932 return nil, nil
933 case '^': // annotated tag commit of the previous line - ignore
934 return nil, nil
935 default:
936 ws := strings.Split(line, " ") // hash then ref
937 if len(ws) != 2 {
938 return nil, ErrPackedRefsBadFormat
939 }
940
941 return plumbing.NewReferenceFromStrings(ws[1], ws[0]), nil
942 }
943}
944
945func (d *DotGit) addRefsFromRefDir(refs *[]*plumbing.Reference, seen map[plumbing.ReferenceName]bool) error {
946 return d.walkReferencesTree(refs, []string{refsPath}, seen)

Callers 2

findPackedRefsInFileMethod · 0.95

Calls 1

NewReferenceFromStringsFunction · 0.92

Tested by

no test coverage detected