Debian Codegraph @

lfs/scanner.go

raw symbols SCIP
1 package lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/
2
3 import (
4 "github.com/git-lfs/git-lfs/v3/configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/"
5 "github.com/git-lfs/git-lfs/v3/gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/"
6 "github.com/git-lfs/git-lfs/v3/toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/"
7 )
8
9 const (
10 // BlobSizeCutoff is used to determine which files to scan for Git LFS
11 // pointers. Any file with a size below this cutoff will be scanned.
12 BlobSizeCutoffscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/BlobSizeCutoff. = 1024
13
14 // stdoutBufSize is the size of the buffers given to a sub-process stdout
15 stdoutBufSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/stdoutBufSize. = 16384
16
17 // chanBufSize is the size of the channels used to pass data from one
18 // sub-process to another.
19 chanBufSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/chanBufSize. = 100
20 )
21
22 // WrappedPointer wraps a pointer.Pointer and provides the git sha1
23 // and the file name associated with the object, taken from the
24 // rev-list output.
25 type WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer# struct {
26 Sha1scip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Sha1. string
27 Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Name. string
28 SrcNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#SrcName. string
29 Statusscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Status. string
30 *Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Pointer.
31 }
32
33 // catFileBatchCheck uses git cat-file --batch-check to get the type
34 // and size of a git object. Any object that isn't of type blob and
35 // under the BlobSizeCutoff will be ignored. revs is a channel over
36 // which strings containing git sha1s will be sent. It returns a channel
37 // from which sha1 strings can be read.
38 func catFileBatchCheckscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/catFileBatchCheck().(revs *StringChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/StringChannelWrapper#, lockableSet *lockableNameSetscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/lockableNameSet#) (*StringChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/StringChannelWrapper#, chan string, error) {
39 smallRevCh := make(chan string, chanBufSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/chanBufSize.)
40 lockableCh := make(chan string, chanBufSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/chanBufSize.)
41 errCh := make(chan error, 2) // up to 2 errors, one from each goroutine
42 if err := runCatFileBatchCheckscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/runCatFileBatchCheck().(smallRevCh, lockableCh, lockableSet, revs, errCh); err != nil {
43 return nil, nil, err
44 }
45 return NewStringChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/NewStringChannelWrapper().(smallRevCh, errCh), lockableCh, nil
46 }
47
48 // catFileBatch() uses an ObjectDatabase from the
49 // github.com/git-lfs/gitobj/v2 package to get the contents of Git
50 // blob objects, given their SHA1s, similar to the behaviour of
51 // 'git cat-file --batch'.
52 // Input Git blob SHA1s should be sent over the revs channel.
53 // The blob contents will be decoded as Git LFS pointers and any valid
54 // pointers will be returned as pointer.Pointer structs in a new channel.
55 func catFileBatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/catFileBatch().(revs *StringChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/StringChannelWrapper#, lockableSet *lockableNameSetscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/lockableNameSet#, gitEnv, osEnv configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#) (*PointerChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/PointerChannelWrapper#, chan string, error) {
56 pointerCh := make(chan *WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#, chanBufSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/chanBufSize.)
57 lockableCh := make(chan string, chanBufSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/chanBufSize.)
58 errCh := make(chan error, 5) // shared by 2 goroutines & may add more detail errors?
59 if err := runCatFileBatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/runCatFileBatch().(pointerCh, lockableCh, lockableSet, revs, errCh, gitEnv, osEnv); err != nil {
60 return nil, nil, err
61 }
62 return NewPointerChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/NewPointerChannelWrapper().(pointerCh, errCh), lockableCh, nil
63 }
64
65 // ChannelWrapper for pointer Scan* functions to more easily return async error data via Wait()
66 // See NewPointerChannelWrapper for construction / use
67 type PointerChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/PointerChannelWrapper# struct {
68 *toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.BaseChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/PointerChannelWrapper#BaseChannelWrapper.
69 Resultsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/PointerChannelWrapper#Results. <-chan *WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#
70 }
71
72 // Construct a new channel wrapper for WrappedPointer
73 // Caller can use s.Results directly for normal processing then call Wait() to finish & check for errors
74 // Scan function is required to create error channel large enough not to block (usually 1 is ok)
75 func NewPointerChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/NewPointerChannelWrapper().(pointerChan <-chan *WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#, errorChan <-chan error) *PointerChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/PointerChannelWrapper# {
76 return &PointerChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/PointerChannelWrapper#{toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.NewBaseChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/NewBaseChannelWrapper().(errorChan), pointerChan}
77 }
78
79 // ChannelWrapper for string channel functions to more easily return async error data via Wait()
80 // Caller can use s.Results directly for normal processing then call Wait() to finish & check for errors
81 // See NewStringChannelWrapper for construction / use
82 type StringChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/StringChannelWrapper# struct {
83 *toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.BaseChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/StringChannelWrapper#BaseChannelWrapper.
84 Resultsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/StringChannelWrapper#Results. <-chan string
85 }
86
87 // Construct a new channel wrapper for string
88 // Caller can use s.Results directly for normal processing then call Wait() to finish & check for errors
89 func NewStringChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/NewStringChannelWrapper().(stringChan <-chan string, errorChan <-chan error) *StringChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/StringChannelWrapper# {
90 return &StringChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/StringChannelWrapper#{toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.NewBaseChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/NewBaseChannelWrapper().(errorChan), stringChan}
91 }
92
93 // ChannelWrapper for TreeBlob channel functions to more easily return async error data via Wait()
94 // See NewTreeBlobChannelWrapper for construction / use
95 type TreeBlobChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/TreeBlobChannelWrapper# struct {
96 *toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.BaseChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/TreeBlobChannelWrapper#BaseChannelWrapper.
97 Resultsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/TreeBlobChannelWrapper#Results. <-chan gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.TreeBlobscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#
98 }
99
100 // Construct a new channel wrapper for TreeBlob
101 // Caller can use s.Results directly for normal processing then call Wait() to finish & check for errors
102 func NewTreeBlobChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/NewTreeBlobChannelWrapper().(treeBlobChan <-chan gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.TreeBlobscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/TreeBlob#, errorChan <-chan error) *TreeBlobChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/TreeBlobChannelWrapper# {
103 return &TreeBlobChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/TreeBlobChannelWrapper#{toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.NewBaseChannelWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/NewBaseChannelWrapper().(errorChan), treeBlobChan}
104 }