Debian Codegraph @

git/ls_tree_scanner.go

raw symbols SCIP
1 package gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/
2
3 import (
4 "bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/"
5 "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/"
6 "ioscip-go gomod github.com/golang/go/src go1.25.0 io/"
7 "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/"
8 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
9 )
10
11 // An entry from ls-tree or rev-list including a blob sha and tree path
12 type TreeBlobscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob# struct {
13 Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#Oid. string
14 Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#Size. int64
15 Modescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#Mode. int32
16 Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#Filename. string
17 }
18
19 type LsTreeScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner# struct {
20 sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#s. *bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/.Scannerscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#
21 treescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#tree. *TreeBlobscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#
22 }
23
24 func NewLsTreeScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/NewLsTreeScanner().(r ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Readerscip-go gomod github.com/golang/go/src go1.25.0 io/Reader#) *LsTreeScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner# {
25 s := bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/.NewScannerscip-go gomod github.com/golang/go/src go1.25.0 bufio/NewScanner().(r)
26 s.Splitscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Split().(scanNullLinesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/scanNullLines().)
27 return &LsTreeScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#{sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#s.: s}
28 }
29
30 func (s *LsTreeScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#) TreeBlobscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#TreeBlob().() *TreeBlobscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob# {
31 return s.treescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#tree.
32 }
33
34 func (s *LsTreeScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#) Errscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#Err().() error {
35 return nil
36 }
37
38 func (s *LsTreeScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#) Scanscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#Scan().() bool {
39 t, hasNext := s.nextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#next().()
40 s.treescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#tree. = t
41 return hasNext
42 }
43
44 func (s *LsTreeScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#) nextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#next().() (*TreeBlobscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#, bool) {
45 hasNext := s.sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#s..Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().()
46 line := s.sscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTreeScanner#s..Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()
47 parts := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitNscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitN().(line, "\t", 2)
48 if len(parts) < 2 {
49 return nil, hasNext
50 }
51
52 attrs := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitNscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitN().(parts[0], " ", 4)
53 if len(attrs) < 4 {
54 return nil, hasNext
55 }
56
57 mode, err := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25.0 strconv/ParseInt().(stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(attrs[0]), 8, 32)
58 if err != nil {
59 return nil, hasNext
60 }
61
62 if attrs[1] != "blob" {
63 return nil, hasNext
64 }
65
66 sz, err := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25.0 strconv/ParseInt().(stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(attrs[3]), 10, 64)
67 if err != nil {
68 return nil, hasNext
69 }
70
71 oid := attrs[2]
72 filename := parts[1]
73 return &TreeBlobscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#{Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#Oid.: oid, Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#Size.: sz, Modescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#Mode.: int32(mode), Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#Filename.: filename}, hasNext
74 }
75
76 func scanNullLinesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/scanNullLines().(data []byte, atEOF bool) (advance int, token []byte, err error) {
77 if atEOF && len(data) == 0 {
78 return 0, nil, nil
79 }
80
81 if i := bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.IndexBytescip-go gomod github.com/golang/go/src go1.25.0 bytes/IndexByte().(data, '\000'); i >= 0 {
82 // We have a full null-terminated line.
83 return i + 1, data[0:i], nil
84 }
85
86 // If we're at EOF, we have a final, non-terminated line. Return it.
87 if atEOF {
88 return len(data), data, nil
89 }
90
91 // Request more data.
92 return 0, nil, nil
93 }