| 1 | package mainscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ |
| 2 | |
| 3 | import ( |
| 4 | "bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/" |
| 5 | "crypto/sha256scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha256`/" |
| 6 | "encoding/hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/" |
| 7 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 8 | "math/randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/" |
| 9 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 10 | "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/" |
| 11 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 12 | |
| 13 | "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`/" |
| 14 | "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`/" |
| 15 | "github.com/git-lfs/git-lfs/v3/lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/" |
| 16 | "github.com/git-lfs/git-lfs/v3/lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/" |
| 17 | tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/ "github.com/git-lfs/git-lfs/v3/t/cmd/utilscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/" |
| 18 | "github.com/git-lfs/git-lfs/v3/tasklogscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/" |
| 19 | "github.com/git-lfs/git-lfs/v3/tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/" |
| 20 | "github.com/spf13/cobrascip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/" |
| 21 | ) |
| 22 | |
| 23 | type TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject# struct { |
| 24 | Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Oid. string |
| 25 | Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Size. int64 |
| 26 | } |
| 27 | |
| 28 | type ServerTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest# struct { |
| 29 | Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest#Name. string |
| 30 | Fscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest#F. func(m tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Manifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Manifest#, oidsExist, oidsMissing []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#) error |
| 31 | } |
| 32 | |
| 33 | var ( |
| 34 | RootCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/RootCmd. = &cobrascip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#{ |
| 35 | Usescip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Use.: "git-lfs-test-server-api [--url=<apiurl> | --clone=<cloneurl>] [<oid-exists-file> <oid-missing-file>]", |
| 36 | Shortscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Short.: "Test a Git LFS API server for compliance", |
| 37 | Runscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Run.: testServerApiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/testServerApi()., |
| 38 | } |
| 39 | apiUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/apiUrl. string |
| 40 | cloneUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/cloneUrl. string |
| 41 | savePrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/savePrefix. string |
| 42 | |
| 43 | testsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/tests. []ServerTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest# |
| 44 | ) |
| 45 | |
| 46 | func mainscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/main().() { |
| 47 | RootCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/RootCmd..Executescip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Execute().() |
| 48 | } |
| 49 | |
| 50 | func testServerApiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/testServerApi().(cmd *cobrascip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#, args []string) { |
| 51 | if (len(apiUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/apiUrl.) == 0 && len(cloneUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/cloneUrl.) == 0) || |
| 52 | (len(apiUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/apiUrl.) != 0 && len(cloneUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/cloneUrl.) != 0) { |
| 53 | exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().("Must supply either --url or --clone (and not both)") |
| 54 | } |
| 55 | |
| 56 | if len(args) != 0 && len(args) != 2 { |
| 57 | exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().("Must supply either no file arguments or both the exists AND missing file") |
| 58 | } |
| 59 | |
| 60 | if len(args) != 0 && len(savePrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/savePrefix.) > 0 { |
| 61 | exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().("Cannot combine input files and --save option") |
| 62 | } |
| 63 | |
| 64 | // Build test data for existing files & upload |
| 65 | // Use test repo for this to simplify the process of making sure data matches oid |
| 66 | // We're not performing a real test at this point (although an upload fail will break it) |
| 67 | var callback testDataCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/testDataCallback# |
| 68 | repo := tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.NewReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/NewRepo().(&callback) |
| 69 | |
| 70 | // Force loading of config before we alter it |
| 71 | repo.GitEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#GitEnv().().Allscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#All.() |
| 72 | repo.Pushdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Pushd().() |
| 73 | defer repo.Popdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Popd().() |
| 74 | |
| 75 | apiClient, manifest := buildManifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/buildManifest().(repo) |
| 76 | defer apiClient.Closescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/Client#Close().() |
| 77 | |
| 78 | var oidsExist, oidsMissing []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject# |
| 79 | if len(args) >= 2 { |
| 80 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("Reading test data from files (no server content changes)\n") |
| 81 | oidsExist = readTestOidsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/readTestOids().(args[0]) |
| 82 | oidsMissing = readTestOidsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/readTestOids().(args[1]) |
| 83 | } else { |
| 84 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("Creating test data (will upload to server)\n") |
| 85 | var err error |
| 86 | oidsExist, oidsMissing, err = buildTestDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/buildTestData().(repo, manifest) |
| 87 | if err != nil { |
| 88 | exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().("Failed to set up test data, aborting") |
| 89 | } |
| 90 | if len(savePrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/savePrefix.) > 0 { |
| 91 | existFile := savePrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/savePrefix. + "_exists" |
| 92 | missingFile := savePrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/savePrefix. + "_missing" |
| 93 | saveTestOidsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/saveTestOids().(existFile, oidsExist) |
| 94 | saveTestOidsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/saveTestOids().(missingFile, oidsMissing) |
| 95 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("Wrote test to %s, %s for future use\n", existFile, missingFile) |
| 96 | } |
| 97 | |
| 98 | } |
| 99 | |
| 100 | ok := runTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/runTests().(manifest, oidsExist, oidsMissing) |
| 101 | if !ok { |
| 102 | exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().("One or more tests failed, see above") |
| 103 | } |
| 104 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.25.0 fmt/Println().("All tests passed") |
| 105 | } |
| 106 | |
| 107 | func readTestOidsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/readTestOids().(filename string) []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject# { |
| 108 | f, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.OpenFilescip-go gomod github.com/golang/go/src go1.25.0 os/OpenFile().(filename, osscip-go gomod github.com/golang/go/src go1.25.0 os/.O_RDONLYscip-go gomod github.com/golang/go/src go1.25.0 os/O_RDONLY., 0644) |
| 109 | if err != nil { |
| 110 | exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().("Error opening file %s", filename) |
| 111 | } |
| 112 | defer f.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 113 | |
| 114 | var ret []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject# |
| 115 | rdr := bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 bufio/NewReader().(f) |
| 116 | line, err := rdr.ReadStringscip-go gomod github.com/golang/go/src go1.25.0 bufio/Reader#ReadString().('\n') |
| 117 | for err == nil { |
| 118 | fields := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Fieldsscip-go gomod github.com/golang/go/src go1.25.0 strings/Fields().(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)) |
| 119 | if len(fields) == 2 { |
| 120 | sz, _ := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25.0 strconv/ParseInt().(fields[1], 10, 64) |
| 121 | ret = append(ret, TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#{Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Oid.: fields[0], Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Size.: sz}) |
| 122 | } |
| 123 | |
| 124 | line, err = rdr.ReadStringscip-go gomod github.com/golang/go/src go1.25.0 bufio/Reader#ReadString().('\n') |
| 125 | } |
| 126 | |
| 127 | return ret |
| 128 | } |
| 129 | |
| 130 | type testDataCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/testDataCallback# struct{} |
| 131 | |
| 132 | func (*testDataCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/testDataCallback#) Fatalfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/testDataCallback#Fatalf().(format string, args ...interface{}) { |
| 133 | exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().(format, args...) |
| 134 | } |
| 135 | func (*testDataCallbackscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/testDataCallback#) Errorfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/testDataCallback#Errorf().(format string, args ...interface{}) { |
| 136 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().(format, args...) |
| 137 | } |
| 138 | |
| 139 | func buildManifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/buildManifest().(r *tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#) (*lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/.Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/Client#, tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Manifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Manifest#) { |
| 140 | // Configure the endpoint manually |
| 141 | finder := lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/.NewEndpointFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/NewEndpointFinder().(r) |
| 142 | |
| 143 | var endp lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# |
| 144 | if len(cloneUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/cloneUrl.) > 0 { |
| 145 | endp = finder.NewEndpointFromCloneURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#NewEndpointFromCloneURL.("upload", cloneUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/cloneUrl.) |
| 146 | } else { |
| 147 | endp = finder.NewEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/EndpointFinder#NewEndpoint.("upload", apiUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/apiUrl.) |
| 148 | } |
| 149 | |
| 150 | apiClient := lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/.NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/NewClient().(r) |
| 151 | apiClient.Endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/Client#Endpoints. = &constantEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#{ |
| 152 | escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#e.: endp, |
| 153 | EndpointFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#EndpointFinder.: apiClient.Endpointsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/Client#Endpoints., |
| 154 | } |
| 155 | return apiClient, tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.NewManifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/NewManifest().(r.Filesystemscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Filesystem().(), apiClient, "", "") |
| 156 | } |
| 157 | |
| 158 | type constantEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint# struct { |
| 159 | escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#e. lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# |
| 160 | |
| 161 | lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/.EndpointFinderscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#EndpointFinder. |
| 162 | } |
| 163 | |
| 164 | func (c *constantEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#) NewEndpointFromCloneURLscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#NewEndpointFromCloneURL().(operation, rawurl string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# { |
| 165 | return c.escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#e. |
| 166 | } |
| 167 | |
| 168 | func (c *constantEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#) NewEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#NewEndpoint().(operation, rawurl string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# { return c.escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#e. } |
| 169 | |
| 170 | func (c *constantEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#) Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#Endpoint().(operation, remote string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# { return c.escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#e. } |
| 171 | |
| 172 | func (c *constantEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#) RemoteEndpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#RemoteEndpoint().(operation, remote string) lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.Endpointscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/Endpoint# { return c.escip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/constantEndpoint#e. } |
| 173 | |
| 174 | func buildTestDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/buildTestData().(repo *tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.Reposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#, manifest tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Manifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Manifest#) (oidsExist, oidsMissing []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#, err error) { |
| 175 | const oidCount = 50 |
| 176 | oidsExist = make([]TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#, 0, oidCount) |
| 177 | oidsMissing = make([]TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#, 0, oidCount) |
| 178 | |
| 179 | // just one commit |
| 180 | logger := tasklogscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/.NewLoggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/NewLogger().(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., |
| 181 | tasklogscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/.ForceProgressscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/ForceProgress().(false), |
| 182 | ) |
| 183 | meter := tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.NewMeterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/NewMeter().(repo.Configurationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Configuration().()) |
| 184 | meter.Loggerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Meter#Logger. = meter.LoggerFromEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Meter#LoggerFromEnv().(repo.OSEnvscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#OSEnv().()) |
| 185 | logger.Enqueuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tasklog`/Logger#Enqueue().(meter) |
| 186 | commit := tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.CommitInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#{CommitterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitterName.: "A N Other", CommitterEmailscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitterEmail.: "[email protected]"} |
| 187 | for i := 0; i < oidCount; i++ { |
| 188 | filename := 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%d.dat", i) |
| 189 | sz := int64(randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.Intnscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Intn().(200)) + 50 |
| 190 | commit.Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files. = append(commit.Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files., &tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: filename, Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: sz}) |
| 191 | meter.Addscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Meter#Add().(sz) |
| 192 | } |
| 193 | outputs := repo.AddCommitsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#AddCommits().([]*tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.CommitInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#{&commit}) |
| 194 | |
| 195 | // now upload |
| 196 | uploadQueue := tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.NewTransferQueuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/NewTransferQueue().(tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Uploadscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Upload., manifest, "origin", tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.WithProgressscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/WithProgress().(meter)) |
| 197 | for _, f := range outputs[0].Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Files. { |
| 198 | oidsExist = append(oidsExist, TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#{Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Oid.: f.Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#Oid., Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Size.: f.Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#Size.}) |
| 199 | |
| 200 | t, err := uploadTransferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/uploadTransfer().(repo.Filesystemscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Filesystem().(), f.Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/Pointer#Oid., "Test file") |
| 201 | if err != nil { |
| 202 | return nil, nil, err |
| 203 | } |
| 204 | uploadQueue.Addscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/TransferQueue#Add().(t.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Name., t.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Path., t.Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Oid., t.Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Size., false, nil) |
| 205 | } |
| 206 | uploadQueue.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/TransferQueue#Wait().() |
| 207 | |
| 208 | for _, err := range uploadQueue.Errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/TransferQueue#Errors().() { |
| 209 | if errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.IsFatalErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/IsFatalError().(err) { |
| 210 | exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().("Fatal error setting up test data: %s", err) |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | // Generate SHAs for missing files, random but repeatable |
| 215 | // No actual file content needed for these |
| 216 | randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.Seedscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Seed().(int64(oidCount)) |
| 217 | runningSha := sha256scip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha256`/.Newscip-go gomod github.com/golang/go/src go1.25.0 `crypto/sha256`/New().() |
| 218 | for i := 0; i < oidCount; i++ { |
| 219 | runningSha.Writescip-go gomod github.com/golang/go/src go1.25.0 io/Writer#Write().([]byte{byte(randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.Intnscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Intn().(256))}) |
| 220 | oid := 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().(runningSha.Sumscip-go gomod github.com/golang/go/src go1.25.0 hash/Hash#Sum().(nil)) |
| 221 | sz := int64(randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.Intnscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Intn().(200)) + 50 |
| 222 | oidsMissing = append(oidsMissing, TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#{Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Oid.: oid, Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Size.: sz}) |
| 223 | } |
| 224 | return oidsExist, oidsMissing, nil |
| 225 | } |
| 226 | |
| 227 | func saveTestOidsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/saveTestOids().(filename string, objs []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#) { |
| 228 | f, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.OpenFilescip-go gomod github.com/golang/go/src go1.25.0 os/OpenFile().(filename, osscip-go gomod github.com/golang/go/src go1.25.0 os/.O_CREATEscip-go gomod github.com/golang/go/src go1.25.0 os/O_CREATE.|osscip-go gomod github.com/golang/go/src go1.25.0 os/.O_TRUNCscip-go gomod github.com/golang/go/src go1.25.0 os/O_TRUNC.|osscip-go gomod github.com/golang/go/src go1.25.0 os/.O_WRONLYscip-go gomod github.com/golang/go/src go1.25.0 os/O_WRONLY., 0644) |
| 229 | if err != nil { |
| 230 | exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().("Error opening file %s", filename) |
| 231 | } |
| 232 | defer f.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 233 | |
| 234 | for _, o := range objs { |
| 235 | f.WriteStringscip-go gomod github.com/golang/go/src go1.25.0 os/File#WriteString().(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 %d\n", o.Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Oid., o.Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Size.)) |
| 236 | } |
| 237 | |
| 238 | } |
| 239 | |
| 240 | func runTestsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/runTests().(manifest tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Manifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Manifest#, oidsExist, oidsMissing []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#) bool { |
| 241 | ok := true |
| 242 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("Running %d tests...\n", len(testsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/tests.)) |
| 243 | for _, t := range testsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/tests. { |
| 244 | err := runTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/runTest().(t, manifest, oidsExist, oidsMissing) |
| 245 | if err != nil { |
| 246 | ok = false |
| 247 | } |
| 248 | } |
| 249 | return ok |
| 250 | } |
| 251 | |
| 252 | func runTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/runTest().(t ServerTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest#, manifest tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Manifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Manifest#, oidsExist, oidsMissing []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#) error { |
| 253 | const linelen = 70 |
| 254 | line := t.Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest#Name. |
| 255 | if len(line) > linelen { |
| 256 | line = line[:linelen] |
| 257 | } else if len(line) < linelen { |
| 258 | line = 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", line, 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().(" ", linelen-len(line))) |
| 259 | } |
| 260 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("%s...\r", line) |
| 261 | |
| 262 | err := t.Fscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest#F.(manifest, oidsExist, oidsMissing) |
| 263 | if err != nil { |
| 264 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("%s FAILED\n", line) |
| 265 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.25.0 fmt/Println().(err.Error()) |
| 266 | } else { |
| 267 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("%s OK\n", line) |
| 268 | } |
| 269 | return err |
| 270 | } |
| 271 | |
| 272 | // Exit prints a formatted message and exits. |
| 273 | func exitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/exit().(format string, args ...interface{}) { |
| 274 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintf().(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., format, args...) |
| 275 | osscip-go gomod github.com/golang/go/src go1.25.0 os/.Exitscip-go gomod github.com/golang/go/src go1.25.0 os/Exit().(2) |
| 276 | } |
| 277 | |
| 278 | func addTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/addTest().(name string, f func(manifest tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Manifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Manifest#, oidsExist, oidsMissing []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#) error) { |
| 279 | testsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/tests. = append(testsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/tests., ServerTestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest#{Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest#Name.: name, Fscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/ServerTest#F.: f}) |
| 280 | } |
| 281 | |
| 282 | func callBatchApiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/callBatchApi().(manifest tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Manifestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Manifest#, dir tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Directionscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Direction#, objs []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#) ([]*tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#, error) { |
| 283 | apiobjs := make([]*tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#, 0, len(objs)) |
| 284 | for _, o := range objs { |
| 285 | apiobjs = append(apiobjs, &tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#{Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Oid.: o.Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Oid., Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Size.: o.Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#Size.}) |
| 286 | } |
| 287 | |
| 288 | bres, err := tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Batchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Batch().(manifest, dir, "origin", nil, apiobjs) |
| 289 | if err != nil { |
| 290 | return nil, err |
| 291 | } |
| 292 | return bres.Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#Objects., nil |
| 293 | } |
| 294 | |
| 295 | // Combine 2 slices into one by "randomly" interleaving |
| 296 | // Not actually random, same sequence each time so repeatable |
| 297 | func interleaveTestDatascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/interleaveTestData().(slice1, slice2 []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#) []TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject# { |
| 298 | // Predictable sequence, mixin existing & missing semi-randomly |
| 299 | randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.Seedscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Seed().(21) |
| 300 | count := len(slice1) + len(slice2) |
| 301 | ret := make([]TestObjectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/TestObject#, 0, count) |
| 302 | slice1Idx := 0 |
| 303 | slice2Idx := 0 |
| 304 | for left := count; left > 0; { |
| 305 | for i := randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.Intnscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Intn().(3) + 1; slice1Idx < len(slice1) && i > 0; i-- { |
| 306 | obj := slice1[slice1Idx] |
| 307 | ret = append(ret, obj) |
| 308 | slice1Idx++ |
| 309 | left-- |
| 310 | } |
| 311 | for i := randscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/.Intnscip-go gomod github.com/golang/go/src go1.25.0 `math/rand`/Intn().(3) + 1; slice2Idx < len(slice2) && i > 0; i-- { |
| 312 | obj := slice2[slice2Idx] |
| 313 | ret = append(ret, obj) |
| 314 | slice2Idx++ |
| 315 | left-- |
| 316 | } |
| 317 | } |
| 318 | return ret |
| 319 | } |
| 320 | |
| 321 | func uploadTransferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/uploadTransfer().(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#, oid, filename string) (*tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#, error) { |
| 322 | localMediaPath, err := fs.ObjectPathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/fs`/Filesystem#ObjectPath().(oid) |
| 323 | if err != nil { |
| 324 | return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrapf().(err, "Error uploading file %s (%s)", filename, oid) |
| 325 | } |
| 326 | |
| 327 | fi, 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().(localMediaPath) |
| 328 | if err != nil { |
| 329 | return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Wrapfscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Wrapf().(err, "Error uploading file %s (%s)", filename, oid) |
| 330 | } |
| 331 | |
| 332 | return &tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/.Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#{ |
| 333 | Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Name.: filename, |
| 334 | Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Path.: localMediaPath, |
| 335 | Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Oid.: oid, |
| 336 | Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Size.: fi.Sizescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileInfo#Size().(), |
| 337 | }, nil |
| 338 | } |
| 339 | |
| 340 | func initscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/init().() { |
| 341 | RootCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/RootCmd..Flagsscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Flags().().StringVarPscip-go gomod github.com/spf13/pflag v1.0.9 `github.com/spf13/pflag`/FlagSet#StringVarP().(&apiUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/apiUrl., "url", "u", "", "URL of the API (must supply this or --clone)") |
| 342 | RootCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/RootCmd..Flagsscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Flags().().StringVarPscip-go gomod github.com/spf13/pflag v1.0.9 `github.com/spf13/pflag`/FlagSet#StringVarP().(&cloneUrlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/cloneUrl., "clone", "c", "", "Clone URL from which to find API (must supply this or --url)") |
| 343 | RootCmdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/RootCmd..Flagsscip-go gomod github.com/spf13/cobra v1.10.2 `github.com/spf13/cobra`/Command#Flags().().StringVarPscip-go gomod github.com/spf13/pflag v1.0.9 `github.com/spf13/pflag`/FlagSet#StringVarP().(&savePrefixscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/git-lfs-test-server-api`/savePrefix., "save", "s", "", "Saves generated data to <prefix>_exists|missing for subsequent use") |
| 344 | } |