Debian Codegraph @

git/git.go

raw symbols SCIP
1 // Package git contains various commands that shell out to git
2 // NOTE: Subject to change, do not rely on this package from outside git-lfs source
3 package gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/
4
5 import (
6 "bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/"
7 "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/"
8 "crypto/sha1scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha1`/"
9 "crypto/sha256scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha256`/"
10 "encoding/hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/"
11 "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/"
12 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
13 "ioscip-go gomod github.com/golang/go/src go1.25.0 io/"
14 "net/urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/"
15 "osscip-go gomod github.com/golang/go/src go1.25.0 os/"
16 "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/"
17 "regexpscip-go gomod github.com/golang/go/src go1.25.0 regexp/"
18 "slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/"
19 "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/"
20 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
21 "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/"
22 "timescip-go gomod github.com/golang/go/src go1.25.0 time/"
23
24 lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/ "github.com/git-lfs/git-lfs/v3/errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/"
25 "github.com/git-lfs/git-lfs/v3/subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/"
26 "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`/"
27 "github.com/git-lfs/git-lfs/v3/trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/"
28 "github.com/git-lfs/gitobj/v2scip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/"
29 "github.com/rubyist/tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/"
30 )
31
32 type RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType# int
33
34 const (
35 RefTypeLocalBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalBranch. = RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#(iota)
36 RefTypeRemoteBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeRemoteBranch. = RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#(iota)
37 RefTypeLocalTagscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalTag. = RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#(iota)
38 RefTypeRemoteTagscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeRemoteTag. = RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#(iota)
39 RefTypeHEADscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeHEAD. = RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#(iota) // current checkout
40 RefTypeOtherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeOther. = RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#(iota) // stash or unknown
41
42 SHA1HexSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/SHA1HexSize. = sha1scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha1`/.Sizescip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha1`/Size. * 2
43 SHA256HexSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/SHA256HexSize. = sha256scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha256`/.Sizescip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha256`/Size. * 2
44 )
45
46 var (
47 ObjectIDRegexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ObjectIDRegex. = fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("(?:[0-9a-f]{%d}(?:[0-9a-f]{%d})?)", SHA1HexSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/SHA1HexSize., SHA256HexSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/SHA256HexSize.-SHA1HexSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/SHA1HexSize.)
48 // ObjectIDLengths is a slice of valid Git hexadecimal object ID
49 // lengths in increasing order.
50 ObjectIDLengthsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ObjectIDLengths. = []int{SHA1HexSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/SHA1HexSize., SHA256HexSizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/SHA256HexSize.}
51 emptyTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/emptyTree. = ""
52 emptyTreeMutexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/emptyTreeMutex. = &syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.Mutexscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#{}
53 )
54
55 type IndexStagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IndexStage# int
56
57 const (
58 IndexStageDefaultscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IndexStageDefault. IndexStagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IndexStage# = iota
59 IndexStageBasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IndexStageBase.
60 IndexStageOursscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IndexStageOurs.
61 IndexStageTheirsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IndexStageTheirs.
62 )
63
64 // Prefix returns the given RefType's prefix, "refs/heads", "ref/remotes",
65 // etc. It returns an additional value of either true/false, whether or not this
66 // given ref type has a prefix.
67 //
68 // If the RefType is unrecognized, Prefix() will panic.
69 func (t RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#) Prefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#Prefix().() (string, bool) {
70 switch t {
71 case RefTypeLocalBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalBranch.:
72 return "refs/heads", true
73 case RefTypeRemoteBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeRemoteBranch.:
74 return "refs/remotes", true
75 case RefTypeLocalTagscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalTag.:
76 return "refs/tags", true
77 default:
78 return "", false
79 }
80 }
81
82 func ParseRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseRef().(absRef, sha string) *Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref# {
83 r := &Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#{Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha.: sha}
84 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(absRef, "refs/heads/") {
85 r.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. = absRef[11:]
86 r.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type. = RefTypeLocalBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalBranch.
87 } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(absRef, "refs/tags/") {
88 r.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. = absRef[10:]
89 r.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type. = RefTypeLocalTagscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalTag.
90 } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(absRef, "refs/remotes/") {
91 r.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. = absRef[13:]
92 r.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type. = RefTypeRemoteBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeRemoteBranch.
93 } else {
94 r.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. = absRef
95 if absRef == "HEAD" {
96 r.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type. = RefTypeHEADscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeHEAD.
97 } else {
98 r.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type. = RefTypeOtherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeOther.
99 }
100 }
101 return r
102 }
103
104 // A git reference (branch, tag etc)
105 type Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref# struct {
106 Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. string
107 Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type. RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#
108 Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha. string
109 }
110
111 // Refspec returns the fully-qualified reference name (including remote), i.e.,
112 // for a remote branch called 'my-feature' on remote 'origin', this function
113 // will return:
114 //
115 // refs/remotes/origin/my-feature
116 func (r *Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#) Refspecscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Refspec().() string {
117 if r == nil {
118 return ""
119 }
120
121 prefix, ok := r.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type..Prefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#Prefix().()
122 if ok {
123 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s/%s", prefix, r.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.)
124 }
125
126 return r.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.
127 }
128
129 // HasValidObjectIDLength returns true if `s` has a length that is a valid
130 // hexadecimal Git object ID length.
131 func HasValidObjectIDLengthscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/HasValidObjectIDLength().(s string) bool {
132 return slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/.Containsscip-go gomod github.com/golang/go/src go1.25.0 slices/Contains().(ObjectIDLengthsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ObjectIDLengths., len(s))
133 }
134
135 // IsZeroObjectID returns true if the string is a valid hexadecimal Git object
136 // ID and represents the all-zeros object ID for some hash algorithm.
137 func IsZeroObjectIDscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IsZeroObjectID().(s string) bool {
138 for _, length := range ObjectIDLengthsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ObjectIDLengths. {
139 if s == stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25.0 strings/Repeat().("0", length) {
140 return true
141 }
142 }
143 return false
144 }
145
146 func EmptyTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/EmptyTree().() (string, error) {
147 emptyTreeMutexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/emptyTreeMutex..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().()
148 defer emptyTreeMutexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/emptyTreeMutex..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().()
149
150 if len(emptyTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/emptyTree.) == 0 {
151 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("hash-object", "-t", "tree", "/dev/null")
152 if err != nil {
153 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git hash-object`: %v", err))
154 }
155 cmd.Stdinscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdin. = nil
156 out, _ := cmd.Outputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Output().()
157 emptyTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/emptyTree. = 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().(string(out))
158 }
159 return emptyTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/emptyTree., nil
160 }
161
162 // Some top level information about a commit (only first line of message)
163 type CommitSummaryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary# struct {
164 Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#Sha. string
165 ShortShascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#ShortSha. string
166 Parentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#Parents. []string
167 CommitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#CommitDate. timescip-go gomod github.com/golang/go/src go1.25.0 time/.Timescip-go gomod github.com/golang/go/src go1.25.0 time/Time#
168 AuthorDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#AuthorDate. timescip-go gomod github.com/golang/go/src go1.25.0 time/.Timescip-go gomod github.com/golang/go/src go1.25.0 time/Time#
169 AuthorNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#AuthorName. string
170 AuthorEmailscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#AuthorEmail. string
171 CommitterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#CommitterName. string
172 CommitterEmailscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#CommitterEmail. string
173 Subjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#Subject. string
174 }
175
176 // Prepend Git config instructions to disable Git LFS filter
177 func gitConfigNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitConfigNoLFS().(args ...string) []string {
178 // Before git 2.8, setting filters to blank causes lots of warnings, so use cat instead (slightly slower)
179 // Also pre 2.2 it failed completely. We used to use it anyway in git 2.2-2.7 and
180 // suppress the messages in stderr, but doing that with standard StderrPipe suppresses
181 // the git clone output (git thinks it's not a terminal) and makes it look like it's
182 // not working. You can get around that with https://github.com/kr/pty but that
183 // causes difficult issues with passing through Stdin for login prompts
184 // This way is simpler & more practical.
185 filterOverride := ""
186 if !IsGitVersionAtLeastscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IsGitVersionAtLeast().("2.8.0") {
187 filterOverride = "cat"
188 }
189
190 return append([]string{
191 "-c", fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("filter.lfs.smudge=%v", filterOverride),
192 "-c", fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("filter.lfs.clean=%v", filterOverride),
193 "-c", "filter.lfs.process=",
194 "-c", "filter.lfs.required=false",
195 }, args...)
196 }
197
198 // Invoke Git with disabled LFS filters
199 func gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().(args ...string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.Cmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#, error) {
200 return subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.ExecCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ExecCommand().("git", gitConfigNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitConfigNoLFS().(args...)...)
201 }
202
203 func gitNoLFSSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSSimple().(args ...string) (string, error) {
204 return subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.SimpleExecscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/SimpleExec().("git", gitConfigNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitConfigNoLFS().(args...)...)
205 }
206
207 func gitNoLFSBufferedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSBuffered().(args ...string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#, error) {
208 return subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedExecscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedExec().("git", gitConfigNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitConfigNoLFS().(args...)...)
209 }
210
211 func gitNoLFSBufferedStdoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSBufferedStdout().(args ...string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#, error) {
212 return subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.StdoutBufferedExecscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/StdoutBufferedExec().("git", gitConfigNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitConfigNoLFS().(args...)...)
213 }
214
215 // Invoke Git with enabled LFS filters
216 func gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/git().(args ...string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.Cmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#, error) {
217 return subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.ExecCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ExecCommand().("git", args...)
218 }
219
220 func gitSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitSimple().(args ...string) (string, error) {
221 return subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.SimpleExecscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/SimpleExec().("git", args...)
222 }
223
224 func gitBufferedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitBuffered().(args ...string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#, error) {
225 return subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedExecscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedExec().("git", args...)
226 }
227
228 func gitBufferedStdoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitBufferedStdout().(args ...string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#, error) {
229 return subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.StdoutBufferedExecscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/StdoutBufferedExec().("git", args...)
230 }
231
232 func CatFilescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CatFile().() (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#, error) {
233 return gitNoLFSBufferedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSBuffered().("cat-file", "--batch-check")
234 }
235
236 func Varscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Var().(name string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.Cmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#, error) {
237 return gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("var", name)
238 }
239
240 func DiffIndexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/DiffIndex().(ref string, cached bool, refresh bool, workingDir string) (*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#, error) {
241 if refresh {
242 _, err := gitSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitSimple().("update-index", "-q", "--refresh")
243 if err != nil {
244 return nil, lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrap().(err, trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Failed to run `git update-index`"))
245 }
246 }
247
248 args := []string{"diff-index", "-M"}
249 if cached {
250 args = append(args, "--cached")
251 }
252 args = append(args, ref)
253
254 if workingDir != "" {
255 args = append([]string{"-C", workingDir}, args...)
256 }
257
258 cmd, err := gitBufferedStdoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitBufferedStdout().(args...)
259 if err != nil {
260 return nil, err
261 }
262 if err = cmd.Stdinscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#Stdin..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().(); err != nil {
263 return nil, err
264 }
265
266 return 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().(cmd.Stdoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#Stdout.), nil
267 }
268
269 func DiffIndexWithPathsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/DiffIndexWithPaths().(ref string, cached bool, paths []string) (string, error) {
270 args := []string{"diff-index"}
271 if cached {
272 args = append(args, "--cached")
273 }
274 args = append(args, ref)
275 args = append(args, "--")
276 args = append(args, paths...)
277
278 output, err := gitSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitSimple().(args...)
279 if err != nil {
280 return "", err
281 }
282
283 return output, nil
284 }
285
286 func HashObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/HashObject().(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#) (string, error) {
287 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("hash-object", "--stdin")
288 if err != nil {
289 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git hash-object`: %v", err))
290 }
291 cmd.Stdinscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdin. = r
292 out, err := cmd.Outputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Output().()
293 if err != nil {
294 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("error building Git blob OID: %s", err))
295 }
296
297 return string(bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 bytes/TrimSpace().(out)), nil
298 }
299
300 func Logscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Log().(args ...string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#, error) {
301 logArgs := append([]string{"log"}, args...)
302 return gitNoLFSBufferedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSBuffered().(logArgs...)
303 }
304
305 func LsRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsRemote().(remote, remoteRef string) (string, error) {
306 if remote == "" {
307 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("remote required"))
308 }
309 if remoteRef == "" {
310 return gitNoLFSSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSSimple().("ls-remote", remote)
311
312 }
313 return gitNoLFSSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSSimple().("ls-remote", remote, remoteRef)
314 }
315
316 func LsTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsTree().(ref string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#, error) {
317 return gitNoLFSBufferedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSBuffered().(
318 "ls-tree",
319 "-r", // recurse
320 "-l", // report object size (we'll need this)
321 "-z", // null line termination
322 "--full-tree", // start at the root regardless of where we are in it
323 ref,
324 )
325 }
326
327 func LsFilesLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LsFilesLFS().() (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.BufferedCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/BufferedCmd#, error) {
328 // This requires Git 2.42.0 for `--format` with `objecttype`.
329 return gitNoLFSBufferedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSBuffered().(
330 "ls-files",
331 "--cached",
332 "--exclude-standard",
333 "--full-name",
334 "--sparse",
335 "-z",
336 "--format=%(objectmode) %(objecttype) %(objectname) %(objectsize)\t%(path)",
337 ":(top,attr:filter=lfs)",
338 )
339 }
340
341 func ResolveRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ResolveRef().(ref string) (*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
342 outp, err := gitNoLFSSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSSimple().("rev-parse", ref, "--symbolic-full-name", ref)
343 if err != nil {
344 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Git can't resolve ref: %q", ref))
345 }
346 if outp == "" {
347 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Git can't resolve ref: %q", ref))
348 }
349
350 lines := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(outp, "\n")
351 fullref := &Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#{Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha.: lines[0]}
352
353 if len(lines) == 1 {
354 // ref is a sha1 and has no symbolic-full-name
355 fullref.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. = lines[0]
356 fullref.Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha. = lines[0]
357 fullref.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type. = RefTypeOtherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeOther.
358 return fullref, nil
359 }
360
361 // parse the symbolic-full-name
362 fullref.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type., fullref.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. = ParseRefToTypeAndNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseRefToTypeAndName().(lines[1])
363 return fullref, nil
364 }
365
366 func ResolveRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ResolveRefs().(refnames []string) ([]*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
367 refs := make([]*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, len(refnames))
368 for i, name := range refnames {
369 ref, err := ResolveRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ResolveRef().(name)
370 if err != nil {
371 return refs, err
372 }
373
374 refs[i] = ref
375 }
376 return refs, nil
377 }
378
379 func CurrentRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CurrentRef().() (*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
380 return ResolveRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ResolveRef().("HEAD")
381 }
382
383 func (c *Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#) CurrentRemoteRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#CurrentRemoteRef().() (*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
384 remoteref, err := c.RemoteRefNameForCurrentBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#RemoteRefNameForCurrentBranch().()
385 if err != nil {
386 return nil, err
387 }
388
389 return ResolveRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ResolveRef().(remoteref)
390 }
391
392 // RemoteRefForCurrentBranch returns the full remote ref (refs/remotes/{remote}/{remotebranch})
393 // that the current branch is tracking.
394 func (c *Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#) RemoteRefNameForCurrentBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#RemoteRefNameForCurrentBranch().() (string, error) {
395 ref, err := CurrentRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CurrentRef().()
396 if err != nil {
397 return "", err
398 }
399
400 if ref.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type. == RefTypeHEADscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeHEAD. || ref.Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type. == RefTypeOtherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeOther. {
401 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("not on a branch"))
402 }
403
404 remote := c.RemoteForBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#RemoteForBranch().(ref.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.)
405 if remote == "" {
406 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("remote not found for branch %q", ref.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.))
407 }
408
409 remotebranch := c.RemoteBranchForLocalBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#RemoteBranchForLocalBranch().(ref.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.)
410
411 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("refs/remotes/%s/%s", remote, remotebranch), nil
412 }
413
414 // RemoteForBranch returns the remote name that a given local branch is tracking (blank if none)
415 func (c *Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#) RemoteForBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#RemoteForBranch().(localBranch string) string {
416 return c.Findscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#Find().(fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("branch.%s.remote", localBranch))
417 }
418
419 // RemoteBranchForLocalBranch returns the name (only) of the remote branch that the local branch is tracking
420 // If no specific branch is configured, returns local branch name
421 func (c *Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#) RemoteBranchForLocalBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#RemoteBranchForLocalBranch().(localBranch string) string {
422 // get remote ref to track, may not be same name
423 merge := c.Findscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration#Find().(fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("branch.%s.merge", localBranch))
424 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(merge, "refs/heads/") {
425 return merge[11:]
426 } else {
427 return localBranch
428 }
429 }
430
431 func RemoteListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RemoteList().() ([]string, error) {
432 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("remote")
433 if err != nil {
434 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git remote`: %v", err))
435 }
436
437 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
438 if err != nil {
439 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git remote`: %v", err))
440 }
441 cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().()
442 defer cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().()
443
444 scanner := 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().(outp)
445
446 var ret []string
447 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
448 ret = append(ret, 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().(scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()))
449 }
450
451 return ret, nil
452 }
453
454 func RemoteURLsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RemoteURLs().(push bool) (map[string][]string, error) {
455 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("remote", "-v")
456 if err != nil {
457 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git remote -v`: %v", err))
458 }
459
460 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
461 if err != nil {
462 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git remote -v`: %v", err))
463 }
464 cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().()
465 defer cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().()
466
467 scanner := 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().(outp)
468
469 text := "(fetch)"
470 if push {
471 text = "(push)"
472 }
473 ret := make(map[string][]string)
474 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
475 // [remote, urlpair-text]
476 pair := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(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().(scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()), "\t")
477 if len(pair) != 2 {
478 continue
479 }
480 // [url, "(fetch)" | "(push)"]
481 urlpair := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(pair[1], " ")
482 if len(urlpair) != 2 || urlpair[1] != text {
483 continue
484 }
485 ret[pair[0]] = append(ret[pair[0]], urlpair[0])
486 }
487
488 return ret, nil
489 }
490
491 func MapRemoteURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/MapRemoteURL().(url string, push bool) (string, bool) {
492 urls, err := RemoteURLsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RemoteURLs().(push)
493 if err != nil {
494 return url, false
495 }
496
497 for name, remotes := range urls {
498 if len(remotes) == 1 && url == remotes[0] {
499 return name, true
500 }
501 }
502 return url, false
503 }
504
505 // Refs returns all of the local and remote branches and tags for the current
506 // repository. Other refs (HEAD, refs/stash, git notes) are ignored.
507 func LocalRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/LocalRefs().() ([]*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
508 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("show-ref")
509 if err != nil {
510 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git show-ref`: %v", err))
511 }
512
513 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
514 if err != nil {
515 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git show-ref`: %v", err))
516 }
517
518 var refs []*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#
519
520 if err := cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().(); err != nil {
521 return refs, err
522 }
523
524 scanner := 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().(outp)
525 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
526 line := 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().(scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().())
527 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, " ", 2)
528 if len(parts) != 2 || !HasValidObjectIDLengthscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/HasValidObjectIDLength().(parts[0]) || len(parts[1]) < 1 {
529 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("Invalid line from `git show-ref`: %q", line)
530 continue
531 }
532
533 rtype, name := ParseRefToTypeAndNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseRefToTypeAndName().(parts[1])
534 if rtype != RefTypeLocalBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalBranch. && rtype != RefTypeLocalTagscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalTag. {
535 continue
536 }
537
538 refs = append(refs, &Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#{name, rtype, parts[0]})
539 }
540
541 return refs, cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().()
542 }
543
544 // UpdateRef moves the given ref to a new sha with a given reason (and creates a
545 // reflog entry, if a "reason" was provided). It returns an error if any were
546 // encountered.
547 func UpdateRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/UpdateRef().(ref *Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, to []byte, reason string) error {
548 args := []string{"update-ref", ref.Refspecscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Refspec().(), hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(to)}
549 if len(reason) > 0 {
550 args = append(args, "-m", reason)
551 }
552
553 _, err := gitNoLFSSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSSimple().(args...)
554 return err
555 }
556
557 // UpdateRefsFromStdinInDir initializes a "git update-ref" command which will
558 // read a series of reference update instructions from standard input and
559 // execute them. The command will operate within the given working
560 // directory "wd". The instructions should follow the NUL-terminated format.
561 func UpdateRefsFromStdinscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/UpdateRefsFromStdin().(wd string) (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.Cmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#, error) {
562 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("update-ref", "--stdin", "-z")
563 cmd.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = wd
564 return cmd, err
565 }
566
567 // ValidateRemote checks that a named remote is valid for use
568 // Mainly to check user-supplied remotes & fail more nicely
569 func ValidateRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ValidateRemote().(remote string) error {
570 remotes, err := RemoteListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RemoteList().()
571 if err != nil {
572 return err
573 }
574 return ValidateRemoteFromListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ValidateRemoteFromList().(remotes, remote)
575 }
576
577 // ValidateRemote checks that a named remote is valid for use given a list from
578 // RemoteList. This is completely identical to ValidateRemote, except that it
579 // allows caching the remote list.
580 func ValidateRemoteFromListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ValidateRemoteFromList().(remotes []string, remote string) error {
581 if slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/.Containsscip-go gomod github.com/golang/go/src go1.25.0 slices/Contains().(remotes, remote) {
582 return nil
583 }
584
585 if err := ValidateRemoteURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ValidateRemoteURL().(remote); err == nil {
586 return nil
587 }
588
589 return errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("invalid remote name: %q", remote))
590 }
591
592 // ValidateRemoteURL checks that a string is a valid Git remote URL
593 func ValidateRemoteURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ValidateRemoteURL().(remote string) error {
594 u, _ := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.Parsescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Parse().(remote)
595 if u == nil || u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme. == "" {
596 // This is either an invalid remote name (maybe the user made a typo
597 // when selecting a named remote) or a bare SSH URL like
598 // "[email protected]:path/to/resource.git". Guess that this is a URL in the latter
599 // form if the string contains a colon ":", and an invalid remote if it
600 // does not.
601 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(remote, ":") {
602 return nil
603 } else {
604 return errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("invalid remote name: %q", remote))
605 }
606 }
607
608 switch u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme. {
609 case "ssh", "http", "https", "git", "file":
610 return nil
611 default:
612 return errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("invalid remote URL protocol %q in %q", u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme., remote))
613 }
614 }
615
616 func RewriteLocalPathAsURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RewriteLocalPathAsURL().(path string) string {
617 var slash string
618 if abs, err := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Absscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Abs().(path); err == nil {
619 // Required for Windows paths to work.
620 if !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(abs, "/") {
621 slash = "/"
622 }
623 path = abs
624 }
625
626 var gitpath string
627 if filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(path) == ".git" {
628 gitpath = path
629 path = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(path)
630 } else {
631 gitpath = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(path, ".git")
632 }
633
634 if _, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Statscip-go gomod github.com/golang/go/src go1.25.0 os/Stat().(gitpath); err == nil {
635 path = gitpath
636 } else if _, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Statscip-go gomod github.com/golang/go/src go1.25.0 os/Stat().(path); err != nil {
637 // Not a local path. We check down here because we perform
638 // canonicalization by stripping off the .git above.
639 return path
640 }
641 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("file://%s%s", slash, filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/ToSlash().(path))
642 }
643
644 func UpdateIndexFromStdinscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/UpdateIndexFromStdin().() (*subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.Cmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#, error) {
645 return gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/git().("update-index", "-q", "--refresh", "--stdin")
646 }
647
648 // RecentBranches returns branches with commit dates on or after the given date/time
649 // Return full Ref type for easier detection of duplicate SHAs etc
650 // since: refs with commits on or after this date will be included
651 // includeRemoteBranches: true to include refs on remote branches
652 // onlyRemote: set to non-blank to only include remote branches on a single remote
653 func RecentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RecentBranches().(since timescip-go gomod github.com/golang/go/src go1.25.0 time/.Timescip-go gomod github.com/golang/go/src go1.25.0 time/Time#, includeRemoteBranches bool, onlyRemote string) ([]*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
654 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("for-each-ref",
655 `--sort=-committerdate`,
656 `--format=%(refname) %(objectname) %(committerdate:iso)`,
657 "refs")
658 if err != nil {
659 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git for-each-ref`: %v", err))
660 }
661 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
662 if err != nil {
663 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git for-each-ref`: %v", err))
664 }
665 cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().()
666 defer cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().()
667
668 scanner := 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().(outp)
669
670 // Output is like this:
671 // refs/heads/master f03686b324b29ff480591745dbfbbfa5e5ac1bd5 2015-08-19 16:50:37 +0100
672 // refs/remotes/origin/master ad3b29b773e46ad6870fdf08796c33d97190fe93 2015-08-13 16:50:37 +0100
673
674 // Output is ordered by latest commit date first, so we can stop at the threshold
675 regex := regexpscip-go gomod github.com/golang/go/src go1.25.0 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.25.0 regexp/MustCompile().(fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().(`^(refs/[^/]+/\S+)\s+(%s)\s+(\d{4}-\d{2}-\d{2}\s+\d{2}\:\d{2}\:\d{2}\s+[\+\-]\d{4})`, ObjectIDRegexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ObjectIDRegex.))
676 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("RECENT: Getting refs >= %v", since)
677 var ret []*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#
678 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
679 line := scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()
680 if match := regex.FindStringSubmatchscip-go gomod github.com/golang/go/src go1.25.0 regexp/Regexp#FindStringSubmatch().(line); match != nil {
681 fullref := match[1]
682 sha := match[2]
683 reftype, ref := ParseRefToTypeAndNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseRefToTypeAndName().(fullref)
684 if reftype == RefTypeRemoteBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeRemoteBranch. {
685 if !includeRemoteBranches {
686 continue
687 }
688 if onlyRemote != "" && !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(ref, onlyRemote+"/") {
689 continue
690 }
691 }
692 // This is a ref we might use
693 // Check the date
694 commitDate, err := ParseGitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseGitDate().(match[3])
695 if err != nil {
696 return ret, err
697 }
698 if commitDate.Beforescip-go gomod github.com/golang/go/src go1.25.0 time/Time#Before().(since) {
699 // the end
700 break
701 }
702 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("RECENT: %v (%v)", ref, commitDate)
703 ret = append(ret, &Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#{ref, reftype, sha})
704 }
705 }
706
707 return ret, nil
708
709 }
710
711 // Get the type & name of a git reference
712 func ParseRefToTypeAndNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseRefToTypeAndName().(fullref string) (t RefTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefType#, name string) {
713 const localPrefix = "refs/heads/"
714 const remotePrefix = "refs/remotes/"
715 const localTagPrefix = "refs/tags/"
716
717 if fullref == "HEAD" {
718 name = fullref
719 t = RefTypeHEADscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeHEAD.
720 } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(fullref, localPrefix) {
721 name = fullref[len(localPrefix):]
722 t = RefTypeLocalBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalBranch.
723 } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(fullref, remotePrefix) {
724 name = fullref[len(remotePrefix):]
725 t = RefTypeRemoteBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeRemoteBranch.
726 } else if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(fullref, localTagPrefix) {
727 name = fullref[len(localTagPrefix):]
728 t = RefTypeLocalTagscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalTag.
729 } else {
730 name = fullref
731 t = RefTypeOtherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeOther.
732 }
733 return
734 }
735
736 // Parse a Git date formatted in ISO 8601 format (%ci/%ai)
737 func ParseGitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseGitDate().(str string) (timescip-go gomod github.com/golang/go/src go1.25.0 time/.Timescip-go gomod github.com/golang/go/src go1.25.0 time/Time#, error) {
738
739 // Unfortunately Go and Git don't overlap in their builtin date formats
740 // Go's time.RFC1123Z and Git's %cD are ALMOST the same, except that
741 // when the day is < 10 Git outputs a single digit, but Go expects a leading
742 // zero - this is enough to break the parsing. Sigh.
743
744 // Format is for 2 Jan 2006, 15:04:05 -7 UTC as per Go
745 return timescip-go gomod github.com/golang/go/src go1.25.0 time/.Parsescip-go gomod github.com/golang/go/src go1.25.0 time/Parse().("2006-01-02 15:04:05 -0700", str)
746 }
747
748 // FormatGitDate converts a Go date into a git command line format date
749 func FormatGitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/FormatGitDate().(tm timescip-go gomod github.com/golang/go/src go1.25.0 time/.Timescip-go gomod github.com/golang/go/src go1.25.0 time/Time#) string {
750 // Git format is "Fri Jun 21 20:26:41 2013 +0900" but no zero-leading for day
751 return tm.Formatscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Format().("Mon Jan 2 15:04:05 2006 -0700")
752 }
753
754 // Get summary information about a commit
755 func GetCommitSummaryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GetCommitSummary().(commit string) (*CommitSummaryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#, error) {
756 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("show", "-s",
757 `--format=%H|%h|%P|%ai|%ci|%ae|%an|%ce|%cn|%s`, commit)
758 if err != nil {
759 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git show`: %v", err))
760 }
761
762 out, err := cmd.CombinedOutputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#CombinedOutput().()
763 if err != nil {
764 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git show`: %v %v", err, string(out)))
765 }
766
767 // At most 10 substrings so subject line is not split on anything
768 fields := 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().(string(out), "|", 10)
769 // Cope with the case where subject is blank
770 if len(fields) >= 9 {
771 ret := &CommitSummaryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#{}
772 // Get SHAs from output, not commit input, so we can support symbolic refs
773 ret.Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#Sha. = fields[0]
774 ret.ShortShascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#ShortSha. = fields[1]
775 ret.Parentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#Parents. = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(fields[2], " ")
776 // %aD & %cD (RFC2822) matches Go's RFC1123Z format
777 ret.AuthorDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#AuthorDate., _ = ParseGitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseGitDate().(fields[3])
778 ret.CommitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#CommitDate., _ = ParseGitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseGitDate().(fields[4])
779 ret.AuthorEmailscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#AuthorEmail. = fields[5]
780 ret.AuthorNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#AuthorName. = fields[6]
781 ret.CommitterEmailscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#CommitterEmail. = fields[7]
782 ret.CommitterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#CommitterName. = fields[8]
783 if len(fields) > 9 {
784 ret.Subjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#Subject. = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimRightscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimRight().(fields[9], "\n")
785 }
786 return ret, nil
787 } else {
788 msg := trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Unexpected output from `git show`: %v", string(out))
789 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(msg)
790 }
791 }
792
793 func GitAndRootDirsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GitAndRootDirs().() (string, string, error) {
794 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("rev-parse", "--git-dir", "--show-toplevel")
795 if err != nil {
796 return "", "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git rev-parse --git-dir --show-toplevel`: %v", err))
797 }
798 buf := &bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#{}
799 cmd.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = buf
800
801 out, err := cmd.Outputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Output().()
802 output := string(out)
803 if err != nil {
804 // If we got a fatal error, it's possible we're on a newer
805 // (2.24+) Git and we're not in a worktree, so fall back to just
806 // looking up the repo directory.
807 if lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.ExitStatusscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/ExitStatus().(err) == 128 {
808 absGitDir, err := GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GitDir().()
809 return absGitDir, "", err
810 }
811 return "", "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git rev-parse --git-dir --show-toplevel`: %q", buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().()))
812 }
813
814 paths := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(output, "\n")
815 pathLen := len(paths)
816
817 if pathLen == 0 {
818 return "", "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("bad `git rev-parse` output: %q", output))
819 }
820
821 absGitDir, err := toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.CanonicalizePathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/CanonicalizePath().(paths[0], false)
822 if err != nil {
823 return "", "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("error converting %q to absolute: %s", paths[0], err))
824 }
825
826 if pathLen == 1 || len(paths[1]) == 0 {
827 return absGitDir, "", nil
828 }
829
830 absRootDir, err := toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.CanonicalizePathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/CanonicalizePath().(paths[1], false)
831 return absGitDir, absRootDir, err
832 }
833
834 func RootDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RootDir().() (string, error) {
835 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("rev-parse", "--show-toplevel")
836 if err != nil {
837 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git rev-parse --show-toplevel`: %v", err))
838 }
839 out, err := cmd.Outputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Output().()
840 if err != nil {
841 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git rev-parse --show-toplevel`: %v %v", err, string(out)))
842 }
843
844 path := 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().(string(out))
845 path, err = toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.TranslateCygwinPathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/TranslateCygwinPath().(path)
846 if err != nil {
847 return "", err
848 }
849
850 if len(path) == 0 {
851 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("no output from `git rev-parse --show-toplevel`"))
852 }
853
854 return toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.CanonicalizePathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/CanonicalizePath().(path, false)
855 }
856
857 func GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GitDir().() (string, error) {
858 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("rev-parse", "--git-dir")
859 if err != nil {
860 // The %w format specifier is unique to fmt.Errorf(), so we
861 // do not pass it to tr.Tr.Get().
862 return "", fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("%s: %w", trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git rev-parse --git-dir`"), err)
863 }
864 buf := &bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#{}
865 cmd.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = buf
866 out, err := cmd.Outputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Output().()
867
868 if err != nil {
869 // The %w format specifier is unique to fmt.Errorf(), so we
870 // do not pass it to tr.Tr.Get().
871 return "", fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("%s: %w %v: %v", trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git rev-parse --git-dir`"), err, string(out), buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().())
872 }
873 path := 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().(string(out))
874 return toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.CanonicalizePathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/CanonicalizePath().(path, false)
875 }
876
877 func GitCommonDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GitCommonDir().() (string, error) {
878 // Versions before 2.5.0 don't have the --git-common-dir option, since
879 // it came in with worktrees, so just fall back to the main Git
880 // directory.
881 if !IsGitVersionAtLeastscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IsGitVersionAtLeast().("2.5.0") {
882 return GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GitDir().()
883 }
884
885 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("rev-parse", "--git-common-dir")
886 if err != nil {
887 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git rev-parse --git-common-dir`: %v", err))
888 }
889 out, err := cmd.Outputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Output().()
890 buf := &bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#{}
891 cmd.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = buf
892 if err != nil {
893 return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git rev-parse --git-common-dir`: %v %v: %v", err, string(out), buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().()))
894 }
895 path := 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().(string(out))
896 path, err = toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.TranslateCygwinPathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/TranslateCygwinPath().(path)
897 if err != nil {
898 return "", err
899 }
900 return toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.CanonicalizePathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/CanonicalizePath().(path, false)
901 }
902
903 // A git worktree (ref + path + flags)
904 type Worktreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree# struct {
905 Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Ref. Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#
906 Dirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Dir. string
907 Prunablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Prunable. bool
908 }
909
910 // GetAllWorktrees returns the refs that all worktrees are using as HEADs plus the worktree's path.
911 // This returns all worktrees plus the main working copy, and works even if
912 // working dir is actually in a worktree right now
913 //
914 // Pass in the git storage dir (parent of 'objects') to work from, in case
915 // we need to fall back to reading the worktree files directly.
916 func GetAllWorktreesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GetAllWorktrees().(storageDir string) ([]*Worktreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#, error) {
917 // Versions before 2.7.0 don't support "git-worktree list", and
918 // those before 2.36.0 don't support the "-z" option, so in these
919 // cases we fall back to reading the .git/worktrees directory entries
920 // and then reading the current worktree's HEAD ref. This requires
921 // the contents of .git/worktrees/*/gitdir files to be absolute paths,
922 // which is only true for Git versions prior to 2.48.0.
923 if !IsGitVersionAtLeastscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IsGitVersionAtLeast().("2.36.0") {
924 return getAllWorktreesFromGitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/getAllWorktreesFromGitDir().(storageDir)
925 }
926
927 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().(
928 "worktree",
929 "list",
930 "--porcelain",
931 "-z", // handle special chars in filenames
932 )
933 if err != nil {
934 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git worktree`: %v", err))
935 }
936
937 stdout, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
938 if err != nil {
939 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to open output pipe to `git worktree`: %v", err))
940 }
941 stderr, err := cmd.StderrPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StderrPipe().()
942 if err != nil {
943 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to open error pipe to `git worktree`: %v", err))
944 }
945
946 if err := cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().(); err != nil {
947 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to start `git worktree`: %v", err))
948 }
949
950 scanner := 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().(stdout)
951 scanner.Splitscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Split().(toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.SplitOnNulscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/SplitOnNul().)
952 var dir string
953 var ref *Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#
954 var prunable bool
955 var worktrees []*Worktreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#
956 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
957 line := scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()
958
959 if len(line) == 0 {
960 if len(dir) > 0 && ref != nil && len(ref.Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha.) > 0 {
961 worktrees = append(worktrees, &Worktreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#{
962 Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Ref.: *ref,
963 Dirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Dir.: dir,
964 Prunablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Prunable.: prunable,
965 })
966 }
967 dir = ""
968 ref = nil
969 continue
970 }
971
972 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().(scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().(), " ", 2)
973
974 // We ignore other attributes such as "locked" for now.
975 switch parts[0] {
976 case "worktree":
977 if len(parts) == 2 && len(dir) == 0 {
978 dir = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Cleanscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Clean().(parts[1])
979 ref = &Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type.: RefTypeOtherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeOther.}
980 prunable = false
981 }
982 case "HEAD":
983 if len(parts) == 2 && ref != nil {
984 ref.Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha. = parts[1]
985 ref.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. = parts[1]
986 }
987 case "branch":
988 if len(parts) == 2 && ref != nil && len(ref.Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha.) > 0 {
989 ref = ParseRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseRef().(parts[1], ref.Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha.)
990 }
991 case "bare":
992 // We ignore bare worktrees.
993 dir = ""
994 ref = nil
995 case "prunable":
996 prunable = true
997 }
998 }
999
1000 // We assume any error output will be short and won't block
1001 // command completion if it isn't drained by a separate goroutine.
1002 msg, _ := ioscip-go gomod github.com/golang/go/src go1.25.0 io/.ReadAllscip-go gomod github.com/golang/go/src go1.25.0 io/ReadAll().(stderr)
1003 if err := cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().(); err != nil {
1004 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("error in `git worktree`: %v: %s", err, msg))
1005 }
1006
1007 return worktrees, nil
1008 }
1009
1010 func getAllWorktreesFromGitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/getAllWorktreesFromGitDir().(storageDir string) ([]*Worktreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#, error) {
1011 worktreesdir := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(storageDir, "worktrees")
1012 dirf, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Openscip-go gomod github.com/golang/go/src go1.25.0 os/Open().(worktreesdir)
1013 if err != nil && !osscip-go gomod github.com/golang/go/src go1.25.0 os/.IsNotExistscip-go gomod github.com/golang/go/src go1.25.0 os/IsNotExist().(err) {
1014 return nil, err
1015 }
1016
1017 var worktrees []*Worktreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#
1018 if err == nil {
1019 // There are some worktrees
1020 defer dirf.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().()
1021 direntries, err := dirf.Readdirscip-go gomod github.com/golang/go/src go1.25.0 os/File#Readdir().(0)
1022 if err != nil {
1023 return nil, err
1024 }
1025 for _, dirfi := range direntries {
1026 if dirfi.IsDirscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileInfo#IsDir().() {
1027 // to avoid having to chdir and run git commands to identify the commit
1028 // just read the HEAD file & git rev-parse if necessary
1029 // Since the git repo is shared the same rev-parse will work from this location
1030 headfile := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(worktreesdir, dirfi.Namescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileInfo#Name().(), "HEAD")
1031 ref, err := parseRefFilescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/parseRefFile().(headfile)
1032 if err != nil {
1033 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("Error reading %v for worktree, skipping: %v", headfile, err)
1034 continue
1035 }
1036
1037 // Read the gitdir file to get the location of the git repo
1038 dirfile := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(worktreesdir, dirfi.Namescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileInfo#Name().(), "gitdir")
1039 dir, err := parseDirFilescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/parseDirFile().(dirfile)
1040 if err != nil {
1041 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("Error reading %v for worktree, skipping: %v", dirfile, err)
1042 continue
1043 }
1044
1045 // Check if the worktree exists.
1046 dir = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(dir)
1047 var prunable bool
1048 if _, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Statscip-go gomod github.com/golang/go/src go1.25.0 os/Stat().(dir); err != nil {
1049 if osscip-go gomod github.com/golang/go/src go1.25.0 os/.IsNotExistscip-go gomod github.com/golang/go/src go1.25.0 os/IsNotExist().(err) {
1050 prunable = true
1051 } else {
1052 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("Error checking worktree directory %s: %v", dir, err)
1053 }
1054 }
1055
1056 worktrees = append(worktrees, &Worktreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#{
1057 Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Ref.: *ref,
1058 Dirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Dir.: dir,
1059 Prunablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Prunable.: prunable,
1060 })
1061 }
1062 }
1063 }
1064
1065 // This has only established the separate worktrees, not the original checkout
1066 // If the storageDir contains a HEAD file and a RootDir then there is a main checkout
1067 // as well; this must be resolveable whether you're in the main checkout or
1068 // a worktree
1069 headfile := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(storageDir, "HEAD")
1070 ref, err := parseRefFilescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/parseRefFile().(headfile)
1071 if err == nil {
1072 dir, err := RootDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RootDir().()
1073 if err == nil {
1074 worktrees = append(worktrees, &Worktreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#{
1075 Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Ref.: *ref,
1076 Dirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Dir.: dir,
1077 Prunablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Prunable.: false,
1078 })
1079 } else { // ok if not exists, probably bare repo
1080 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("Error getting toplevel for main checkout, skipping: %v", err)
1081 }
1082 } else if !osscip-go gomod github.com/golang/go/src go1.25.0 os/.IsNotExistscip-go gomod github.com/golang/go/src go1.25.0 os/IsNotExist().(err) { // ok if not exists, probably bare repo
1083 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("Error reading %v for main checkout, skipping: %v", headfile, err)
1084 }
1085 return worktrees, nil
1086 }
1087
1088 // Manually parse a reference file like HEAD and return the Ref it resolves to
1089 func parseRefFilescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/parseRefFile().(filename string) (*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
1090 bytes, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.ReadFilescip-go gomod github.com/golang/go/src go1.25.0 os/ReadFile().(filename)
1091 if err != nil {
1092 return nil, err
1093 }
1094 contents := 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().(string(bytes))
1095 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(contents, "ref:") {
1096 contents = 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().(contents[4:])
1097 }
1098 return ResolveRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ResolveRef().(contents)
1099 }
1100
1101 func parseDirFilescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/parseDirFile().(filename string) (string, error) {
1102 bytes, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.ReadFilescip-go gomod github.com/golang/go/src go1.25.0 os/ReadFile().(filename)
1103 if err != nil {
1104 return "", err
1105 }
1106 contents := 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().(string(bytes))
1107 return contents, nil
1108 }
1109
1110 // IsBare returns whether or not a repository is bare. It requires that the
1111 // current working directory is a repository.
1112 //
1113 // If there was an error determining whether or not the repository is bare, it
1114 // will be returned.
1115 func IsBarescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IsBare().() (bool, error) {
1116 s, err := subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.SimpleExecscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/SimpleExec().(
1117 "git", "rev-parse", "--is-bare-repository")
1118
1119 if err != nil {
1120 return false, err
1121 }
1122
1123 return strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.ParseBoolscip-go gomod github.com/golang/go/src go1.25.0 strconv/ParseBool().(s)
1124 }
1125
1126 // For compatibility with git clone we must mirror all flags in CloneWithoutFilters
1127 type CloneFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags# struct {
1128 // --template <template_directory>
1129 TemplateDirectoryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#TemplateDirectory. string
1130 // -l --local
1131 Localscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Local. bool
1132 // -s --shared
1133 Sharedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Shared. bool
1134 // --no-hardlinks
1135 NoHardlinksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#NoHardlinks. bool
1136 // -q --quiet
1137 Quietscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Quiet. bool
1138 // -n --no-checkout
1139 NoCheckoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#NoCheckout. bool
1140 // --progress
1141 Progressscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Progress. bool
1142 // --bare
1143 Barescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Bare. bool
1144 // --mirror
1145 Mirrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Mirror. bool
1146 // -o <name> --origin <name>
1147 Originscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Origin. string
1148 // -b <name> --branch <name>
1149 Branchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Branch. string
1150 // -u <upload-pack> --upload-pack <pack>
1151 Uploadscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Upload. string
1152 // --reference <repository>
1153 Referencescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Reference. string
1154 // --reference-if-able <repository>
1155 ReferenceIfAblescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ReferenceIfAble. string
1156 // --dissociate
1157 Dissociatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Dissociate. bool
1158 // --separate-git-dir <git dir>
1159 SeparateGitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#SeparateGit. string
1160 // --depth <depth>
1161 Depthscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Depth. string
1162 // --recursive
1163 Recursivescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Recursive. bool
1164 // --recurse-submodules
1165 RecurseSubmodulesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#RecurseSubmodules. bool
1166 // -c <value> --config <value>
1167 Configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Config. string
1168 // --single-branch
1169 SingleBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#SingleBranch. bool
1170 // --no-single-branch
1171 NoSingleBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#NoSingleBranch. bool
1172 // --verbose
1173 Verbosescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Verbose. bool
1174 // --ipv4
1175 Ipv4scip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Ipv4. bool
1176 // --ipv6
1177 Ipv6scip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Ipv6. bool
1178 // --shallow-since <date>
1179 ShallowSincescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ShallowSince. string
1180 // --shallow-since <date>
1181 ShallowExcludescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ShallowExclude. string
1182 // --shallow-submodules
1183 ShallowSubmodulesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ShallowSubmodules. bool
1184 // --no-shallow-submodules
1185 NoShallowSubmodulesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#NoShallowSubmodules. bool
1186 // jobs <n>
1187 Jobsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Jobs. int64
1188 }
1189
1190 // CloneWithoutFilters clones a git repo but without the smudge filter enabled
1191 // so that files in the working copy will be pointers and not real LFS data
1192 func CloneWithoutFiltersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneWithoutFilters().(flags CloneFlagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#, args []string) error {
1193
1194 cmdargs := []string{"clone"}
1195
1196 // flags
1197 if flags.Barescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Bare. {
1198 cmdargs = append(cmdargs, "--bare")
1199 }
1200 if len(flags.Branchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Branch.) > 0 {
1201 cmdargs = append(cmdargs, "--branch", flags.Branchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Branch.)
1202 }
1203 if len(flags.Configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Config.) > 0 {
1204 cmdargs = append(cmdargs, "--config", flags.Configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Config.)
1205 }
1206 if len(flags.Depthscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Depth.) > 0 {
1207 cmdargs = append(cmdargs, "--depth", flags.Depthscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Depth.)
1208 }
1209 if flags.Dissociatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Dissociate. {
1210 cmdargs = append(cmdargs, "--dissociate")
1211 }
1212 if flags.Ipv4scip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Ipv4. {
1213 cmdargs = append(cmdargs, "--ipv4")
1214 }
1215 if flags.Ipv6scip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Ipv6. {
1216 cmdargs = append(cmdargs, "--ipv6")
1217 }
1218 if flags.Localscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Local. {
1219 cmdargs = append(cmdargs, "--local")
1220 }
1221 if flags.Mirrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Mirror. {
1222 cmdargs = append(cmdargs, "--mirror")
1223 }
1224 if flags.NoCheckoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#NoCheckout. {
1225 cmdargs = append(cmdargs, "--no-checkout")
1226 }
1227 if flags.NoHardlinksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#NoHardlinks. {
1228 cmdargs = append(cmdargs, "--no-hardlinks")
1229 }
1230 if flags.NoSingleBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#NoSingleBranch. {
1231 cmdargs = append(cmdargs, "--no-single-branch")
1232 }
1233 if len(flags.Originscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Origin.) > 0 {
1234 cmdargs = append(cmdargs, "--origin", flags.Originscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Origin.)
1235 }
1236 if flags.Progressscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Progress. {
1237 cmdargs = append(cmdargs, "--progress")
1238 }
1239 if flags.Quietscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Quiet. {
1240 cmdargs = append(cmdargs, "--quiet")
1241 }
1242 if flags.Recursivescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Recursive. {
1243 cmdargs = append(cmdargs, "--recursive")
1244 }
1245 if flags.RecurseSubmodulesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#RecurseSubmodules. {
1246 cmdargs = append(cmdargs, "--recurse-submodules")
1247 }
1248 if len(flags.Referencescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Reference.) > 0 {
1249 cmdargs = append(cmdargs, "--reference", flags.Referencescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Reference.)
1250 }
1251 if len(flags.ReferenceIfAblescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ReferenceIfAble.) > 0 {
1252 cmdargs = append(cmdargs, "--reference-if-able", flags.ReferenceIfAblescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ReferenceIfAble.)
1253 }
1254 if len(flags.SeparateGitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#SeparateGit.) > 0 {
1255 cmdargs = append(cmdargs, "--separate-git-dir", flags.SeparateGitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#SeparateGit.)
1256 }
1257 if flags.Sharedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Shared. {
1258 cmdargs = append(cmdargs, "--shared")
1259 }
1260 if flags.SingleBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#SingleBranch. {
1261 cmdargs = append(cmdargs, "--single-branch")
1262 }
1263 if len(flags.TemplateDirectoryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#TemplateDirectory.) > 0 {
1264 cmdargs = append(cmdargs, "--template", flags.TemplateDirectoryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#TemplateDirectory.)
1265 }
1266 if len(flags.Uploadscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Upload.) > 0 {
1267 cmdargs = append(cmdargs, "--upload-pack", flags.Uploadscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Upload.)
1268 }
1269 if flags.Verbosescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Verbose. {
1270 cmdargs = append(cmdargs, "--verbose")
1271 }
1272 if len(flags.ShallowSincescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ShallowSince.) > 0 {
1273 cmdargs = append(cmdargs, "--shallow-since", flags.ShallowSincescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ShallowSince.)
1274 }
1275 if len(flags.ShallowExcludescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ShallowExclude.) > 0 {
1276 cmdargs = append(cmdargs, "--shallow-exclude", flags.ShallowExcludescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ShallowExclude.)
1277 }
1278 if flags.ShallowSubmodulesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#ShallowSubmodules. {
1279 cmdargs = append(cmdargs, "--shallow-submodules")
1280 }
1281 if flags.NoShallowSubmodulesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#NoShallowSubmodules. {
1282 cmdargs = append(cmdargs, "--no-shallow-submodules")
1283 }
1284 if flags.Jobsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Jobs. > -1 {
1285 cmdargs = append(cmdargs, "--jobs", strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.FormatIntscip-go gomod github.com/golang/go/src go1.25.0 strconv/FormatInt().(flags.Jobsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CloneFlags#Jobs., 10))
1286 }
1287
1288 // Now args
1289 cmdargs = append(cmdargs, args...)
1290 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().(cmdargs...)
1291 if err != nil {
1292 return errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git clone`: %v", err))
1293 }
1294
1295 // Assign all streams direct
1296 cmd.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdout. = osscip-go gomod github.com/golang/go/src go1.25.0 os/.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 os/Stdout.
1297 cmd.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = osscip-go gomod github.com/golang/go/src go1.25.0 os/.Stderrscip-go gomod github.com/golang/go/src go1.25.0 os/Stderr.
1298 cmd.Stdinscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdin. = osscip-go gomod github.com/golang/go/src go1.25.0 os/.Stdinscip-go gomod github.com/golang/go/src go1.25.0 os/Stdin.
1299
1300 err = cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().()
1301 if err != nil {
1302 return errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to start `git clone`: %v", err))
1303 }
1304
1305 err = cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().()
1306 if err != nil {
1307 return errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("`git clone` failed: %v", err))
1308 }
1309
1310 return nil
1311 }
1312
1313 // Checkout performs an invocation of `git-checkout(1)` applying the given
1314 // treeish, paths, and force option, if given.
1315 //
1316 // If any error was encountered, it will be returned immediately. Otherwise, the
1317 // checkout has occurred successfully.
1318 func Checkoutscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Checkout().(treeish string, paths []string, force bool) error {
1319 args := []string{"checkout"}
1320 if force {
1321 args = append(args, "--force")
1322 }
1323
1324 if len(treeish) > 0 {
1325 args = append(args, treeish)
1326 }
1327
1328 if len(paths) > 0 {
1329 args = append(args, append([]string{"--"}, paths...)...)
1330 }
1331
1332 _, err := gitNoLFSSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSSimple().(args...)
1333 return err
1334 }
1335
1336 // CachedRemoteRefs returns the list of branches & tags for a remote which are
1337 // currently cached locally. No remote request is made to verify them.
1338 func CachedRemoteRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CachedRemoteRefs().(remoteName string) ([]*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
1339 var ret []*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#
1340 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().("show-ref")
1341 if err != nil {
1342 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git show-ref`: %v", err))
1343 }
1344
1345 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
1346 if err != nil {
1347 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git show-ref`: %v", err))
1348 }
1349 cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().()
1350 scanner := 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().(outp)
1351
1352 refPrefix := fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("refs/remotes/%v/", remoteName)
1353 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
1354 if sha, name, ok := parseShowRefLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/parseShowRefLine().(refPrefix, scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()); ok {
1355 // Don't match head
1356 if name == "HEAD" {
1357 continue
1358 }
1359 ret = append(ret, &Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#{name, RefTypeRemoteBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeRemoteBranch., sha})
1360 }
1361 }
1362 return ret, cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().()
1363 }
1364
1365 func parseShowRefLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/parseShowRefLine().(refPrefix, line string) (sha, name string, ok bool) {
1366 // line format: <sha> <space> <ref>
1367 sha, ref, found := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Cutscip-go gomod github.com/golang/go/src go1.25.0 strings/Cut().(line, " ")
1368 if !found {
1369 return "", "", false
1370 }
1371 if !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(ref, refPrefix) {
1372 return "", "", false
1373 }
1374 return sha, 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().(ref[len(refPrefix):]), true
1375 }
1376
1377 // Fetch performs a fetch with no arguments against the given remotes.
1378 func Fetchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Fetch().(remotes ...string) error {
1379 if len(remotes) == 0 {
1380 return nil
1381 }
1382
1383 var args []string
1384 if len(remotes) > 1 {
1385 args = []string{"--multiple", "--"}
1386 }
1387 args = append(args, remotes...)
1388
1389 _, err := gitNoLFSSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSSimple().(append([]string{"fetch"}, args...)...)
1390 return err
1391 }
1392
1393 // RemoteRefs returns a list of branches and, optionally, tags for a remote
1394 // by actually accessing the remote via git ls-remote.
1395 func RemoteRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RemoteRefs().(remoteName string, withTags bool) ([]*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
1396 var ret []*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#
1397 args := []string{"ls-remote", "--heads", "-q"}
1398 if withTags {
1399 args = append(args, "--tags")
1400 }
1401 args = append(args, remoteName)
1402
1403 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().(args...)
1404 if err != nil {
1405 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git ls-remote`: %v", err))
1406 }
1407
1408 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
1409 if err != nil {
1410 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git ls-remote`: %v", err))
1411 }
1412 cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().()
1413 scanner := 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().(outp)
1414
1415 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
1416 if sha, ns, name, ok := parseLsRemoteLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/parseLsRemoteLine().(scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()); ok {
1417 // Don't match head
1418 if name == "HEAD" {
1419 continue
1420 }
1421
1422 typ := RefTypeRemoteBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeRemoteBranch.
1423 if ns == "tags" {
1424 if !withTags {
1425 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("unexpected tag returned by `git ls-remote --heads`: %s %s", name, sha))
1426 }
1427 typ = RefTypeRemoteTagscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeRemoteTag.
1428 }
1429 ret = append(ret, &Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#{name, typ, sha})
1430 }
1431 }
1432 return ret, cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().()
1433 }
1434
1435 func parseLsRemoteLinescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/parseLsRemoteLine().(line string) (sha, ns, name string, ok bool) {
1436 const headPrefix = "refs/heads/"
1437 const tagPrefix = "refs/tags/"
1438
1439 // line format: <sha> <tab> <ref>
1440 sha, ref, found := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Cutscip-go gomod github.com/golang/go/src go1.25.0 strings/Cut().(line, "\t")
1441 if !found {
1442 return "", "", "", false
1443 }
1444 switch {
1445 case stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(ref, headPrefix):
1446 ns = "heads"
1447 name = ref[len(headPrefix):]
1448 case stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(ref, tagPrefix):
1449 ns = "tags"
1450 name = ref[len(tagPrefix):]
1451 default:
1452 return "", "", "", false
1453 }
1454 return sha, ns, 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().(name), true
1455 }
1456
1457 // AllRefs returns a slice of all references in a Git repository in the current
1458 // working directory, or an error if those references could not be loaded.
1459 func AllRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/AllRefs().() ([]*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
1460 return AllRefsInscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/AllRefsIn().("")
1461 }
1462
1463 // AllRefs returns a slice of all references in a Git repository located in a
1464 // the given working directory "wd", or an error if those references could not
1465 // be loaded.
1466 func AllRefsInscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/AllRefsIn().(wd string) ([]*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, error) {
1467 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().(
1468 "for-each-ref", "--format=%(objectname)%00%(refname)")
1469 if err != nil {
1470 return nil, lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrap().(err, trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git for-each-ref`: %v", err))
1471 }
1472 cmd.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = wd
1473
1474 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
1475 if err != nil {
1476 return nil, lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrap().(err, trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("cannot open pipe"))
1477 }
1478 cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().()
1479
1480 refs := make([]*Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#, 0)
1481
1482 scanner := 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().(outp)
1483 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
1484 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().(scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().(), "\x00", 2)
1485 if len(parts) != 2 {
1486 return nil, lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().(
1487 "invalid `git for-each-ref` line: %q", scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()))
1488 }
1489
1490 sha := parts[0]
1491 typ, name := ParseRefToTypeAndNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ParseRefToTypeAndName().(parts[1])
1492
1493 refs = append(refs, &Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#{
1494 Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.: name,
1495 Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type.: typ,
1496 Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha.: sha,
1497 })
1498 }
1499
1500 if err := scanner.Errscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Err().(); err != nil {
1501 return nil, err
1502 }
1503
1504 return refs, nil
1505 }
1506
1507 // GetTrackedFiles returns a list of files which are tracked in Git which match
1508 // the pattern specified (standard wildcard form)
1509 // Both pattern and the results are relative to the current working directory, not
1510 // the root of the repository
1511 func GetTrackedFilesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GetTrackedFiles().(pattern string) ([]string, error) {
1512 safePattern := sanitizePatternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/sanitizePattern().(pattern)
1513 rootWildcard := len(safePattern) < len(pattern) && stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.ContainsRunescip-go gomod github.com/golang/go/src go1.25.0 strings/ContainsRune().(safePattern, '*')
1514
1515 var ret []string
1516 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().(
1517 "ls-files",
1518 "--ignored",
1519 "--cached", // include things which are staged but not committed right now
1520 "-z", // handle special chars in filenames
1521 "-x",
1522 safePattern)
1523 if err != nil {
1524 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git ls-files`: %v", err))
1525 }
1526
1527 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
1528 if err != nil {
1529 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git ls-files`: %v", err))
1530 }
1531 cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().()
1532 scanner := 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().(outp)
1533 scanner.Splitscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Split().(toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.SplitOnNulscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/SplitOnNul().)
1534 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
1535 line := scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()
1536
1537 // If the given pattern is a root wildcard, skip all files which
1538 // are not direct descendants of the repository's root.
1539 //
1540 // This matches the behavior of how .gitattributes performs
1541 // filename matches.
1542 if rootWildcard && filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(line) != "." {
1543 continue
1544 }
1545
1546 ret = append(ret, 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().(line))
1547 }
1548 return ret, cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().()
1549 }
1550
1551 func sanitizePatternscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/sanitizePattern().(pattern string) string {
1552 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(pattern, "/") {
1553 return pattern[1:]
1554 }
1555
1556 return pattern
1557 }
1558
1559 // GetFilesChanged returns a list of files which were changed, either between 2
1560 // commits, or at a single commit if you only supply one argument and a blank
1561 // string for the other
1562 func GetFilesChangedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GetFilesChanged().(from, to string) ([]string, error) {
1563 var files []string
1564 args := []string{
1565 "-c", "core.quotepath=false", // handle special chars in filenames
1566 "diff-tree",
1567 "--no-commit-id",
1568 "--name-only",
1569 "-r",
1570 }
1571
1572 if len(from) > 0 {
1573 args = append(args, from)
1574 }
1575 if len(to) > 0 {
1576 args = append(args, to)
1577 }
1578 args = append(args, "--") // no ambiguous patterns
1579
1580 cmd, err := gitNoLFSscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFS().(args...)
1581 if err != nil {
1582 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git diff-tree`: %v", err))
1583 }
1584 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
1585 if err != nil {
1586 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to call `git diff-tree`: %v", err))
1587 }
1588 if err := cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().(); err != nil {
1589 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to start `git diff-tree`: %v", err))
1590 }
1591 scanner := 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().(outp)
1592 for scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
1593 files = append(files, 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().(scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()))
1594 }
1595 if err := cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().(); err != nil {
1596 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("`git diff-tree` failed: %v", err))
1597 }
1598
1599 return files, err
1600 }
1601
1602 // IsFileModified returns whether the filepath specified is modified according
1603 // to `git status`. A file is modified if it has uncommitted changes in the
1604 // working copy or the index. This includes being untracked.
1605 func IsFileModifiedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IsFileModified().(filepath string) (bool, error) {
1606
1607 args := []string{
1608 "-c", "core.quotepath=false", // handle special chars in filenames
1609 "status",
1610 "--porcelain",
1611 "--", // separator in case filename ambiguous
1612 filepath,
1613 }
1614 cmd, err := gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/git().(args...)
1615 if err != nil {
1616 return false, lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrap().(err, trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git status`"))
1617 }
1618 outp, err := cmd.StdoutPipescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#StdoutPipe().()
1619 if err != nil {
1620 return false, lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrap().(err, trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Failed to call `git status`"))
1621 }
1622 if err := cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().(); err != nil {
1623 return false, lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrap().(err, trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Failed to start `git status`"))
1624 }
1625 matched := false
1626 for scanner := 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().(outp); scanner.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().(); {
1627 line := scanner.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()
1628 // Porcelain format is "<I><W> <filename>"
1629 // Where <I> = index status, <W> = working copy status
1630 if len(line) > 3 {
1631 // Double-check even though should be only match
1632 if 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().(line[3:]) == filepath {
1633 matched = true
1634 // keep consuming output to exit cleanly
1635 // will typically fall straight through anyway due to 1 line output
1636 }
1637 }
1638 }
1639 if err := cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().(); err != nil {
1640 return false, lfserrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrap().(err, trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("`git status` failed"))
1641 }
1642
1643 return matched, nil
1644 }
1645
1646 // IsWorkingCopyDirty returns true if and only if the working copy in which the
1647 // command was executed is dirty as compared to the index.
1648 //
1649 // If the status of the working copy could not be determined, an error will be
1650 // returned instead.
1651 func IsWorkingCopyDirtyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IsWorkingCopyDirty().() (bool, error) {
1652 bare, err := IsBarescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/IsBare().()
1653 if bare || err != nil {
1654 return false, err
1655 }
1656
1657 out, err := gitSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitSimple().("status", "--porcelain")
1658 if err != nil {
1659 return false, err
1660 }
1661 return len(out) != 0, nil
1662 }
1663
1664 func ObjectDatabasescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/ObjectDatabase().(osEnv, gitEnv Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Environment#, gitdir, tempdir string) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.ObjectDatabasescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#, error) {
1665 var options []gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Optionscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Option#
1666 objdir, ok := osEnv.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Environment#Get.("GIT_OBJECT_DIRECTORY")
1667 if !ok {
1668 objdir = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(gitdir, "objects")
1669 }
1670 alternates, _ := osEnv.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Environment#Get.("GIT_ALTERNATE_OBJECT_DIRECTORIES")
1671 if alternates != "" {
1672 options = append(options, gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Alternatesscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Alternates().(alternates))
1673 }
1674 hashAlgo, _ := gitEnv.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Environment#Get.("extensions.objectformat")
1675 if hashAlgo != "" {
1676 options = append(options, gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.ObjectFormatscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectFormat().(gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.ObjectFormatAlgorithmscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectFormatAlgorithm#(hashAlgo)))
1677 }
1678 odb, err := gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.FromFilesystemscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/FromFilesystem().(objdir, tempdir, options...)
1679 if err != nil {
1680 return nil, err
1681 }
1682 if odb.Hasherscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#Hasher().() == nil {
1683 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("unsupported repository hash algorithm %q", hashAlgo))
1684 }
1685 return odb, nil
1686 }
1687
1688 func remotesForTreeishscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/remotesForTreeish().(treeish string) []string {
1689 var outp string
1690 var err error
1691 if treeish == "" {
1692 //Treeish is empty for sparse checkout
1693 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("git: treeish: not provided")
1694 outp, err = gitNoLFSSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSSimple().("branch", "-r", "--contains", "HEAD")
1695 } else {
1696 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("git: treeish: %q", treeish)
1697 outp, err = gitNoLFSSimplescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/gitNoLFSSimple().("branch", "-r", "--contains", treeish)
1698 }
1699 if err != nil || outp == "" {
1700 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("git: symbolic name: can't resolve symbolic name for ref: %q", treeish)
1701 return []string{}
1702 }
1703 return stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(outp, "\n")
1704 }
1705
1706 // remoteForRef will try to determine the remote from the ref name.
1707 // This will return an empty string if any of the remote names have a slash
1708 // because slashes introduce ambiguity. Consider two refs:
1709 //
1710 // 1. upstream/main
1711 // 2. upstream/test/main
1712 //
1713 // Is the remote "upstream" or "upstream/test"? It could be either, or both.
1714 // We could use git for-each-ref with %(upstream:remotename) if there were a tracking branch,
1715 // but this is not guaranteed to exist either.
1716 func remoteForRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/remoteForRef().(refname string) string {
1717 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("git: working ref: %s", refname)
1718 remotes, err := RemoteListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RemoteList().()
1719 if err != nil {
1720 return ""
1721 }
1722 parts := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(refname, "/")
1723 if len(parts) < 2 {
1724 return ""
1725 }
1726 for _, name := range remotes {
1727 if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(name, "/") {
1728 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("git: ref remote: cannot determine remote for ref %s since remote %s contains a slash", refname, name)
1729 return ""
1730 }
1731 }
1732 remote := parts[0]
1733 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("git: working remote %s", remote)
1734 return remote
1735 }
1736
1737 func getValidRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/getValidRemote().(refs []string) string {
1738 for _, ref := range refs {
1739 if ref != "" {
1740 return ref
1741 }
1742 }
1743 return ""
1744 }
1745
1746 // FirstRemoteForTreeish returns the first remote found which contains the treeish.
1747 func FirstRemoteForTreeishscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/FirstRemoteForTreeish().(treeish string) string {
1748 name := getValidRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/getValidRemote().(remotesForTreeishscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/remotesForTreeish().(treeish))
1749 if name == "" {
1750 tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("git: remote treeish: no valid remote refs parsed for %q", treeish)
1751 return ""
1752 }
1753 return remoteForRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/remoteForRef().(name)
1754 }