process lines from a packed-refs file
(line string)
| 946 | |
| 947 | // process lines from a packed-refs file |
| 948 | func (d *DotGit) processLine(line string) (*plumbing.Reference, error) { |
| 949 | if len(line) == 0 { |
| 950 | return nil, nil |
| 951 | } |
| 952 | |
| 953 | switch line[0] { |
| 954 | case '#': // comment - ignore |
| 955 | return nil, nil |
| 956 | case '^': // annotated tag commit of the previous line - ignore |
| 957 | return nil, nil |
| 958 | default: |
| 959 | ws := strings.Split(line, " ") // hash then ref |
| 960 | if len(ws) != 2 { |
| 961 | return nil, ErrPackedRefsBadFormat |
| 962 | } |
| 963 | |
| 964 | return plumbing.NewReferenceFromStrings(ws[1], ws[0]), nil |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | func (d *DotGit) addRefsFromRefDir(refs *[]*plumbing.Reference, seen map[plumbing.ReferenceName]bool) error { |
| 969 | return d.walkReferencesTree(refs, []string{refsPath}, seen) |
no test coverage detected