process lines from a packed-refs file
(line string)
| 923 | |
| 924 | // process lines from a packed-refs file |
| 925 | func (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 | |
| 945 | func (d *DotGit) addRefsFromRefDir(refs *[]*plumbing.Reference, seen map[plumbing.ReferenceName]bool) error { |
| 946 | return d.walkReferencesTree(refs, []string{refsPath}, seen) |
no test coverage detected