MCPcopy
hub / github.com/git-lfs/git-lfs / writeTestStateFile

Function writeTestStateFile

t/cmd/lfstest-gitserver.go:170–182  ·  view source on GitHub ↗

writeTestStateFile writes contents to either the file referenced by the environment variable envVar, or defaultFilename if that's not set. Returns the filename that was used

(contents []byte, envVar, defaultFilename string)

Source from the content-addressed store, hash-verified

168// environment variable envVar, or defaultFilename if that's not set. Returns
169// the filename that was used
170func writeTestStateFile(contents []byte, envVar, defaultFilename string) string {
171 f := os.Getenv(envVar)
172 if len(f) == 0 {
173 f = defaultFilename
174 }
175 file, err := os.Create(f)
176 if err != nil {
177 log.Fatalln(err)
178 }
179 file.Write(contents)
180 file.Close()
181 return f
182}
183
184type lfsObject struct {
185 Oid string `json:"oid,omitempty"`

Callers 1

mainFunction · 0.85

Calls 2

CloseMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected