Debian Codegraph @

t/cmd/util/testutils.go

raw symbols SCIP
1 package utilscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/
2
3 // Utility functions for more complex go tests
4 // Need to be in a separate test package so they can be imported anywhere
5 // Also can't add _test.go suffix to exclude from main build (import doesn't work)
6
7 // To avoid import cycles, append "_test" to the package statement of any test using
8 // this package and use "import . original/package/name" to get the same visibility
9 // as if the test was in the same package (as usual)
10
11 import (
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 "math/randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/"
15 "osscip-go gomod github.com/golang/go/src go1.25.0 os/"
16 "os/execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/"
17 "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/"
18 "runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/"
19 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
20 "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/"
21 "timescip-go gomod github.com/golang/go/src go1.25.0 time/"
22
23 "github.com/git-lfs/git-lfs/v3/configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/"
24 "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/fsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/fs`/"
26 "github.com/git-lfs/git-lfs/v3/gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/"
27 "github.com/git-lfs/git-lfs/v3/lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/"
28 )
29
30 func initscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/init().() {
31 path := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Getenvscip-go gomod github.com/golang/go/src go1.25.0 os/Getenv().("PATH")
32 sep := ""
33 if path != "" {
34 if runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.25.0 runtime/GOOS. == "windows" {
35 sep = ";"
36 } else {
37 sep = ":"
38 }
39 }
40
41 // Strip the trailing "t/cmd/util/testutils.go" from the path to this
42 // source file to create a path to the working tree's "bin" directory,
43 // then prepend that to the PATH environment variable to ensure our
44 // "git-lfs" binary is used in preference to any installed versions when
45 // executing the Go tests.
46 _, srcdir, _, _ := runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/.Callerscip-go gomod github.com/golang/go/src go1.25.0 runtime/Caller().(0)
47 for i := 0; i < 4; i++ {
48 srcdir = 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().(srcdir)
49 }
50 var err error
51 srcdir, 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().(srcdir)
52 if err != nil {
53 panic(err)
54 }
55 osscip-go gomod github.com/golang/go/src go1.25.0 os/.Setenvscip-go gomod github.com/golang/go/src go1.25.0 os/Setenv().("PATH", 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().(srcdir, "bin")+sep+path)
56 }
57
58 type RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoType# int
59
60 const (
61 // Normal repo with working copy
62 RepoTypeNormalscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeNormal. = RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoType#(iota)
63 // Bare repo (no working copy)
64 RepoTypeBarescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeBare. = RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoType#(iota)
65 // Repo with working copy but git dir is separate
66 RepoTypeSeparateDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeSeparateDir. = RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoType#(iota)
67 )
68
69 var (
70 // Deterministic sequence of seeds for file data
71 fileInputSeedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/fileInputSeed. = randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.NewSourcescip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/NewSource().(0)
72 storageOncescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/storageOnce. syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.Oncescip-go gomod github.com/golang/go/src go1.25.0 sync/Once#
73 )
74
75 type RepoCreateSettingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings# struct {
76 RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#RepoType. RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoType#
77 }
78
79 // Callback interface (testing.T compatible)
80 type RepoCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback# interface {
81 // Fatalf reports error and fails
82 Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.(format string, args ...interface{})
83 // Errorf reports error and continues
84 Errorfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Errorf.(format string, args ...interface{})
85 }
86
87 type Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo# struct {
88 // Path to the repo, working copy if non-bare
89 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path. string
90 // Path to the git dir
91 GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir. string
92 // Paths to remotes
93 Remotesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Remotes. map[string]*Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#
94 // Settings used to create this repo
95 Settingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Settings. *RepoCreateSettingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#
96 // Previous dir for pushd
97 popDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#popDir. string
98 // Test callback
99 callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback. RepoCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#
100 cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#cfg. *configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#
101 gitfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#gitfilter. *lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/.GitFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/GitFilter#
102 fsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#fs. *fsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/fs`/.Filesystemscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/fs`/Filesystem#
103 }
104
105 // Change to repo dir but save current dir
106 func (r *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) Pushdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Pushd().() {
107 if r.popDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#popDir. != "" {
108 r.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Cannot Pushd twice")
109 }
110 oldwd, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Getwdscip-go gomod github.com/golang/go/src go1.25.0 os/Getwd().()
111 if err != nil {
112 r.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Can't get cwd %v", err)
113 }
114 err = osscip-go gomod github.com/golang/go/src go1.25.0 os/.Chdirscip-go gomod github.com/golang/go/src go1.25.0 os/Chdir().(r.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path.)
115 if err != nil {
116 r.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Can't chdir %v", err)
117 }
118 r.popDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#popDir. = oldwd
119 }
120
121 func (r *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) Popdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Popd().() {
122 if r.popDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#popDir. != "" {
123 err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Chdirscip-go gomod github.com/golang/go/src go1.25.0 os/Chdir().(r.popDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#popDir.)
124 if err != nil {
125 r.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Can't chdir %v", err)
126 }
127 r.popDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#popDir. = ""
128 }
129 }
130
131 func (r *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) Filesystemscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Filesystem().() *fsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/fs`/.Filesystemscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/fs`/Filesystem# {
132 return r.fsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#fs.
133 }
134
135 func (r *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Configuration().() *configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration# {
136 return r.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#cfg.
137 }
138
139 func (r *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) GitConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitConfig().() *gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Configuration# {
140 return r.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#cfg..GitConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#GitConfig().()
141 }
142
143 func (r *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) GitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitEnv().() configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment# {
144 return r.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#cfg..Gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#Git.
145 }
146
147 func (r *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) OSEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#OSEnv().() configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment# {
148 return r.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#cfg..Osscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#Os.
149 }
150
151 func (r *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) Cleanupscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Cleanup().() {
152 // pop out if necessary
153 r.Popdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Popd().()
154
155 // Make sure cwd isn't inside a path we're going to delete
156 oldwd, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Getwdscip-go gomod github.com/golang/go/src go1.25.0 os/Getwd().()
157 if err == nil {
158 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().(oldwd, r.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path.) ||
159 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().(oldwd, r.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir.) {
160 osscip-go gomod github.com/golang/go/src go1.25.0 os/.Chdirscip-go gomod github.com/golang/go/src go1.25.0 os/Chdir().(osscip-go gomod github.com/golang/go/src go1.25.0 os/.TempDirscip-go gomod github.com/golang/go/src go1.25.0 os/TempDir().())
161 }
162 }
163
164 if r.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir. != "" {
165 osscip-go gomod github.com/golang/go/src go1.25.0 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.25.0 os/RemoveAll().(r.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir.)
166 r.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir. = ""
167 }
168 if r.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path. != "" {
169 osscip-go gomod github.com/golang/go/src go1.25.0 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.25.0 os/RemoveAll().(r.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path.)
170 r.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path. = ""
171 }
172 for _, remote := range r.Remotesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Remotes. {
173 remote.Cleanupscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Cleanup().()
174 }
175 r.Remotesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Remotes. = nil
176 }
177
178 // NewRepo creates a new git repo in a new temp dir
179 func NewReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/NewRepo().(callback RepoCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#) *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo# {
180 return newReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/newRepo().(callback, &RepoCreateSettingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#{
181 RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#RepoType.: RepoTypeNormalscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeNormal.,
182 })
183 }
184
185 // NewBareRepo creates a new bare git repo in a new temp dir
186 // Note that the repository's path does not end in ".git".
187 func NewBareReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/NewBareRepo().(callback RepoCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#) *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo# {
188 return newReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/newRepo().(callback, &RepoCreateSettingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#{
189 RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#RepoType.: RepoTypeBarescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeBare.,
190 })
191 }
192
193 // newRepo creates a new git repo in a new temp dir with more control over settings
194 func newReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/newRepo().(callback RepoCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#, settings *RepoCreateSettingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#) *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo# {
195 ret := &Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#{
196 Settingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Settings.: settings,
197 Remotesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Remotes.: make(map[string]*Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#),
198 callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback.: callback,
199 }
200
201 path, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.MkdirTempscip-go gomod github.com/golang/go/src go1.25.0 os/MkdirTemp().("", "lfsRepo")
202 if err != nil {
203 callback.Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Can't create temp dir for git repo: %v", err)
204 }
205 ret.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path. = path
206 args := []string{"init"}
207 switch settings.RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#RepoType. {
208 case RepoTypeBarescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeBare.:
209 args = append(args, "--bare")
210 ret.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir. = ret.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path.
211 case RepoTypeSeparateDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeSeparateDir.:
212 gitdir, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.MkdirTempscip-go gomod github.com/golang/go/src go1.25.0 os/MkdirTemp().("", "lfstestgitdir")
213 if err != nil {
214 ret.Cleanupscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Cleanup().()
215 callback.Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Can't create temp dir for git repo: %v", err)
216 }
217 args = append(args, "--separate-dir", gitdir)
218 ret.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir. = gitdir
219 default:
220 ret.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir. = 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().(ret.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path., ".git")
221 }
222
223 args = append(args, path)
224 cmd := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().("git", args...)
225 err = cmd.Runscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Run().()
226 if err != nil {
227 ret.Cleanupscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Cleanup().()
228 callback.Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Unable to create git repo at %v: %v", path, err)
229 }
230
231 ret.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#cfg. = configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.NewInscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/NewIn().(ret.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path., ret.GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir.)
232 ret.fsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#fs. = ret.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#cfg..Filesystemscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#Filesystem().()
233 ret.gitfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#gitfilter. = lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/.NewGitFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/NewGitFilter().(ret.cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#cfg.)
234
235 // Configure default user/email so not reliant on env
236 ret.Pushdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Pushd().()
237 RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(callback, true, "config", "user.name", "Git LFS Tests")
238 RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(callback, true, "config", "user.email", "[email protected]")
239 ret.Popdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Popd().()
240
241 return ret
242 }
243
244 // WrapRepo creates a new Repo instance for an existing git repo
245 func WrapReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrapRepo().(c RepoCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#, path string) *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo# {
246 cfg := configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.NewInscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/NewIn().(path, "")
247 return &Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#{
248 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path.: path,
249 GitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitDir.: cfg.LocalGitDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#LocalGitDir().(),
250 Settingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Settings.: &RepoCreateSettingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#{
251 RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#RepoType.: RepoTypeNormalscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeNormal.,
252 },
253 callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback.: c,
254 cfgscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#cfg.: cfg,
255 gitfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#gitfilter.: lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/.NewGitFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/NewGitFilter().(cfg),
256 fsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#fs.: cfg.Filesystemscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Configuration#Filesystem().(),
257 }
258 }
259
260 // Simplistic fire & forget running of git command - returns combined output
261 func RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(callback RepoCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#, failureCheck bool, args ...string) string {
262 outp, err := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().("git", args...).CombinedOutputscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#CombinedOutput().()
263 if failureCheck && err != nil {
264 callback.Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Error running git command 'git %v': %v %v", stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Joinscip-go gomod github.com/golang/go/src go1.25.0 strings/Join().(args, " "), err, string(outp))
265 }
266 return string(outp)
267
268 }
269
270 // Input data for a single file in a commit
271 type FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput# struct {
272 // Name of file (required)
273 Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename. string
274 // Size of file (required)
275 Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size. int64
276 // Input data (optional, if provided will be source of data)
277 DataReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#DataReader. 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#
278 // Input data (optional, if provided will be source of data)
279 Datascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Data. string
280 }
281
282 func (infile *FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#) AddToIndexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#AddToIndex().(output *CommitOutputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#, repo *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) {
283 inputData := infile.getFileInputReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#getFileInputReader().()
284 pointer, err := infile.writeLFSPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#writeLFSPointer().(repo, inputData)
285 if err != nil {
286 repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Errorfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Errorf.("%+v", err)
287 return
288 }
289 output.Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Files. = append(output.Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Files., pointer)
290 RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback., true, "add", infile.Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.)
291 }
292
293 func (infile *FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#) writeLFSPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#writeLFSPointer().(repo *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#, inputData 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#) (*lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/.Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#, error) {
294 cleaned, err := repo.gitfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#gitfilter..Cleanscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/GitFilter#Clean().(inputData, infile.Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename., infile.Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size., nil)
295 if err != nil {
296 return nil, errorsscip-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, "creating pointer file")
297 }
298
299 // this only created the temp file, move to final location
300 tmpfile := cleaned.Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/cleanedAsset#Filename.
301 mediafile, err := repo.fsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#fs..ObjectPathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/fs`/Filesystem#ObjectPath().(cleaned.Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#Oid.)
302 if err != nil {
303 return nil, errorsscip-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, "local media path")
304 }
305
306 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().(mediafile); err != nil {
307 if err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Renamescip-go gomod github.com/golang/go/src go1.25.0 os/Rename().(tmpfile, mediafile); err != nil {
308 return nil, err
309 }
310 }
311
312 // Write pointer to local filename for adding (not using clean filter)
313 osscip-go gomod github.com/golang/go/src go1.25.0 os/.MkdirAllscip-go gomod github.com/golang/go/src go1.25.0 os/MkdirAll().(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().(infile.Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.), 0755)
314 f, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Createscip-go gomod github.com/golang/go/src go1.25.0 os/Create().(infile.Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.)
315 if err != nil {
316 return nil, errorsscip-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, "creating pointer file")
317 }
318 _, err = cleaned.Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/cleanedAsset#Pointer..Encodescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#Encode().(f)
319 f.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().()
320 if err != nil {
321 return nil, errorsscip-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, "encoding pointer file")
322 }
323
324 return cleaned.Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/cleanedAsset#Pointer., nil
325 }
326
327 func (infile *FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#) getFileInputReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#getFileInputReader().() 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# {
328 if infile.DataReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#DataReader. != nil {
329 return infile.DataReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#DataReader.
330 }
331
332 if len(infile.Datascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Data.) > 0 {
333 return stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 strings/NewReader().(infile.Datascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Data.)
334 }
335
336 // Different data for each file but deterministic
337 return NewPlaceholderDataReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/NewPlaceholderDataReader().(fileInputSeedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/fileInputSeed..Int63scip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Source#Int63().(), infile.Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.)
338 }
339
340 // Input for defining commits for test repo
341 type CommitInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput# struct {
342 // Date that we should commit on (optional, leave blank for 'now')
343 CommitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#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#
344 // List of files to include in this commit
345 Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files. []*FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#
346 // List of parent branches (all branches must have been created in a previous NewBranch or be main)
347 // Can be omitted to just use the parent of the previous commit
348 ParentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#ParentBranches. []string
349 // Name of a new branch we should create at this commit (optional - main not required)
350 NewBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#NewBranch. string
351 // Names of any tags we should create at this commit (optional)
352 Tagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Tags. []string
353 // Name of committer
354 CommitterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitterName. string
355 // Email of committer
356 CommitterEmailscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitterEmail. string
357 }
358
359 // Output struct with details of commits created for test
360 type CommitOutputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput# struct {
361 Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Sha. string
362 Parentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Parents. []string
363 Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Files. []*lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/.Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#
364 }
365
366 func commitAtDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/commitAtDate().(atDate 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#, committerName, committerEmail, msg string) error {
367 var args []string
368 if committerName != "" && committerEmail != "" {
369 args = append(args, "-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().("user.name=%v", committerName))
370 args = append(args, "-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().("user.email=%v", committerEmail))
371 }
372 args = append(args, "commit", "--allow-empty", "-m", msg)
373 cmd := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().("git", args...)
374 env := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Environscip-go gomod github.com/golang/go/src go1.25.0 os/Environ().()
375 // set GIT_COMMITTER_DATE environment var e.g. "Fri Jun 21 20:26:41 2013 +0900"
376 if atDate.IsZeroscip-go gomod github.com/golang/go/src go1.25.0 time/Time#IsZero().() {
377 env = append(env, "GIT_COMMITTER_DATE=")
378 env = append(env, "GIT_AUTHOR_DATE=")
379 } else {
380 env = append(env, 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().("GIT_COMMITTER_DATE=%v", gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.FormatGitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/FormatGitDate().(atDate)))
381 env = append(env, 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().("GIT_AUTHOR_DATE=%v", gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.FormatGitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/FormatGitDate().(atDate)))
382 }
383 cmd.Envscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Env. = env
384 out, err := cmd.CombinedOutputscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#CombinedOutput().()
385 if err != nil {
386 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().("%v %v", err, string(out))
387 }
388 return nil
389 }
390
391 func (repo *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) AddCommitsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#AddCommits().(inputs []*CommitInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#) []*CommitOutputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput# {
392 if repo.Settingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Settings..RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#RepoType. == RepoTypeBarescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeBare. {
393 repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Cannot use AddCommits on a bare repo; clone it & push changes instead")
394 }
395
396 // Change to repo working dir
397 oldwd, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Getwdscip-go gomod github.com/golang/go/src go1.25.0 os/Getwd().()
398 if err != nil {
399 repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Can't get cwd %v", err)
400 }
401 err = osscip-go gomod github.com/golang/go/src go1.25.0 os/.Chdirscip-go gomod github.com/golang/go/src go1.25.0 os/Chdir().(repo.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path.)
402 if err != nil {
403 repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Can't chdir to repo %v", err)
404 }
405 // Used to check whether we need to checkout another commit before
406 lastBranch := "main"
407 outputs := make([]*CommitOutputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#, 0, len(inputs))
408
409 for i, input := range inputs {
410 output := &CommitOutputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#{}
411 // first, are we on the correct branch
412 if len(input.ParentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#ParentBranches.) > 0 {
413 if input.ParentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#ParentBranches.[0] != lastBranch {
414 RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback., true, "checkout", input.ParentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#ParentBranches.[0])
415 lastBranch = input.ParentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#ParentBranches.[0]
416 }
417 }
418 // Is this a merge?
419 if len(input.ParentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#ParentBranches.) > 1 {
420 // Always take the *other* side in a merge so we adopt changes
421 // also don't automatically commit, we'll do that below
422 args := []string{"merge", "--no-ff", "--no-commit", "--strategy-option=theirs"}
423 args = append(args, input.ParentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#ParentBranches.[1:]...)
424 RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback., false, args...)
425 } else if input.NewBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#NewBranch. != "" {
426 RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback., true, "checkout", "-b", input.NewBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#NewBranch.)
427 lastBranch = input.NewBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#NewBranch.
428 }
429 // Any files to write?
430 for _, infile := range input.Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files. {
431 infile.AddToIndexscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#AddToIndex().(output, repo)
432 }
433 // Now commit
434 err = commitAtDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/commitAtDate().(input.CommitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitDate., input.CommitterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitterName., input.CommitterEmailscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitterEmail.,
435 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().("Test commit %d", i))
436 if err != nil {
437 repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Error committing: %v", err)
438 }
439
440 commit, err := gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.GetCommitSummaryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/GetCommitSummary().("HEAD")
441 if err != nil {
442 repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Error determining commit SHA: %v", err)
443 }
444
445 // tags
446 for _, tag := range input.Tagsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Tags. {
447 // Use annotated tags, assume full release tags (also tag objects have edge cases)
448 RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback., true, "tag", "-a", "-m", "Added tag", tag)
449 }
450
451 output.Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Sha. = commit.Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#Sha.
452 output.Parentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Parents. = commit.Parentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/CommitSummary#Parents.
453 outputs = append(outputs, output)
454 }
455
456 // Restore cwd
457 err = osscip-go gomod github.com/golang/go/src go1.25.0 os/.Chdirscip-go gomod github.com/golang/go/src go1.25.0 os/Chdir().(oldwd)
458 if err != nil {
459 repo.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Can't restore old cwd %v", err)
460 }
461
462 return outputs
463 }
464
465 // Add a new remote (generate a path for it to live in, will be cleaned up)
466 func (r *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) AddRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#AddRemote().(name string) *Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo# {
467 if _, exists := r.Remotesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Remotes.[name]; exists {
468 r.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback..Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCallback#Fatalf.("Remote %v already exists", name)
469 }
470 remote := newReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/newRepo().(r.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback., &RepoCreateSettingsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#{
471 RepoTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoCreateSettings#RepoType.: RepoTypeBarescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RepoTypeBare.,
472 })
473 r.Remotesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Remotes.[name] = remote
474 RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(r.callbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#callback., true, "remote", "add", name, remote.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Path.)
475 return remote
476 }
477
478 // Just a pseudo-random stream of bytes (not cryptographic)
479 // Calls RNG a bit less often than using rand.Source directly
480 type PlaceholderDataReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader# struct {
481 sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#source. randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.Sourcescip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Source#
482 bytesLeftscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#bytesLeft. int64
483 }
484
485 func NewPlaceholderDataReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/NewPlaceholderDataReader().(seed, size int64) *PlaceholderDataReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader# {
486 return &PlaceholderDataReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#{randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.NewSourcescip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/NewSource().(seed), size}
487 }
488
489 func (r *PlaceholderDataReaderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#) Readscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#Read().(p []byte) (int, error) {
490 c := len(p)
491 i := 0
492 for i < c && r.bytesLeftscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#bytesLeft. > 0 {
493 // Use all 8 bytes of the 64-bit random number
494 val64 := r.sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#source..Int63scip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Source#Int63().()
495 for j := 0; j < 8 && i < c && r.bytesLeftscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#bytesLeft. > 0; j++ {
496 // Duplicate this byte 16 times (faster)
497 for k := 0; k < 16 && r.bytesLeftscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#bytesLeft. > 0; k++ {
498 p[i] = byte(val64)
499 i++
500 r.bytesLeftscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#bytesLeft.--
501 }
502 // Next byte from the 8-byte number
503 val64 = val64 >> 8
504 }
505 }
506 var err error
507 if r.bytesLeftscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PlaceholderDataReader#bytesLeft. == 0 {
508 err = ioscip-go gomod github.com/golang/go/src go1.25.0 io/.EOFscip-go gomod github.com/golang/go/src go1.25.0 io/EOF.
509 }
510 return i, err
511 }
512
513 // RefsByName implements sort.Interface for []*git.Ref based on name
514 type RefsByNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RefsByName# []*gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#
515
516 func (a RefsByNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RefsByName#) Lenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RefsByName#Len().() int { return len(a) }
517 func (a RefsByNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RefsByName#) Swapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RefsByName#Swap().(i, j int) { a[i], a[j] = a[j], a[i] }
518 func (a RefsByNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RefsByName#) Lessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RefsByName#Less().(i, j int) bool { return a[i].Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. < a[j].Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name. }
519
520 // WorktreesByName implements sort.Interface for []*git.Worktree based on dir
521 type WorktreesByNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WorktreesByName# []*gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.Worktreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#
522
523 func (a WorktreesByNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WorktreesByName#) Lenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WorktreesByName#Len().() int { return len(a) }
524 func (a WorktreesByNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WorktreesByName#) Swapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WorktreesByName#Swap().(i, j int) { a[i], a[j] = a[j], a[i] }
525 func (a WorktreesByNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WorktreesByName#) Lessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WorktreesByName#Less().(i, j int) bool { return a[i].Dirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Dir. < a[j].Dirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Worktree#Dir. }
526
527 // WrappedPointersByOid implements sort.Interface for []*lfs.WrappedPointer based on oid
528 type WrappedPointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrappedPointersByOid# []*lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/.WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#
529
530 func (a WrappedPointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrappedPointersByOid#) Lenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrappedPointersByOid#Len().() int { return len(a) }
531 func (a WrappedPointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrappedPointersByOid#) Swapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrappedPointersByOid#Swap().(i, j int) { a[i], a[j] = a[j], a[i] }
532 func (a WrappedPointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrappedPointersByOid#) Lessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrappedPointersByOid#Less().(i, j int) bool { return a[i].Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Pointer..Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#Oid. < a[j].Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Pointer..Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#Oid. }
533
534 // PointersByOid implements sort.Interface for []*lfs.Pointer based on oid
535 type PointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PointersByOid# []*lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/.Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#
536
537 func (a PointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PointersByOid#) Lenscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PointersByOid#Len().() int { return len(a) }
538 func (a PointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PointersByOid#) Swapscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PointersByOid#Swap().(i, j int) { a[i], a[j] = a[j], a[i] }
539 func (a PointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PointersByOid#) Lessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/PointersByOid#Less().(i, j int) bool { return a[i].Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#Oid. < a[j].Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#Oid. }