| 1 | package githistoryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/ |
| 2 | |
| 3 | import ( |
| 4 | "encoding/hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 6 | "ioscip-go gomod github.com/golang/go/src go1.25.0 io/" |
| 7 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 8 | "os/execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/" |
| 9 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 10 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 11 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 12 | |
| 13 | "github.com/git-lfs/gitobj/v2scip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/" |
| 14 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 15 | ) |
| 16 | |
| 17 | // DatabaseFromFixture returns a *gitobj.ObjectDatabase instance that is safely |
| 18 | // mutable and created from a template equivalent to the fixture that you |
| 19 | // provided it. |
| 20 | // |
| 21 | // If any error was encountered, it will call t.Fatalf() immediately. |
| 22 | func DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, name string) *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.ObjectDatabasescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase# { |
| 23 | path, err := copyToTmpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/copyToTmp().(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().("fixtures", name)) |
| 24 | if err != nil { |
| 25 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: could not copy fixture %s: %v", name, err) |
| 26 | } |
| 27 | |
| 28 | db, err := gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.FromFilesystemscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/FromFilesystem().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(path, "objects"), "") |
| 29 | if err != nil { |
| 30 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: could not create object database: %v", err) |
| 31 | } |
| 32 | return db |
| 33 | } |
| 34 | |
| 35 | // AssertBlobContents asserts that the blob contents given by loading the path |
| 36 | // starting from the root tree "tree" has the given "contents". |
| 37 | func AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, db *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.ObjectDatabasescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#, tree, path, contents string) { |
| 38 | // First, load the root tree. |
| 39 | root, err := db.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#Tree().(HexDecodescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/HexDecode().(t, tree)) |
| 40 | if err != nil { |
| 41 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: cannot load tree: %s: %s", tree, err) |
| 42 | } |
| 43 | |
| 44 | // Then, iterating through each part of the filepath (i.e., a/b/c.txt -> |
| 45 | // []string{"a", "b", "c.txt"}). |
| 46 | parts := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(path, "/") |
| 47 | for i := 0; i < len(parts)-1; i++ { |
| 48 | part := parts[i] |
| 49 | |
| 50 | // Load the subtree given by that name. |
| 51 | var subtree *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree# |
| 52 | for _, entry := range root.Entriesscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#Entries. { |
| 53 | if entry.Namescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/TreeEntry#Name. != part { |
| 54 | continue |
| 55 | } |
| 56 | |
| 57 | subtree, err = db.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#Tree().(entry.Oidscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/TreeEntry#Oid.) |
| 58 | if err != nil { |
| 59 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: cannot load subtree %s: %s", 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().(parts[:i]...), err) |
| 60 | } |
| 61 | break |
| 62 | } |
| 63 | |
| 64 | if subtree == nil { |
| 65 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: subtree %s does not exist", path) |
| 66 | } |
| 67 | |
| 68 | // And re-assign it to root, creating a sort of pseudo-recursion. |
| 69 | root = subtree |
| 70 | } |
| 71 | |
| 72 | filename := parts[len(parts)-1] |
| 73 | |
| 74 | // Find the blob given by the last entry in parts (the filename). |
| 75 | var blob *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob# |
| 76 | for _, entry := range root.Entriesscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#Entries. { |
| 77 | if entry.Namescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/TreeEntry#Name. == filename { |
| 78 | blob, err = db.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#Blob().(entry.Oidscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/TreeEntry#Oid.) |
| 79 | if err != nil { |
| 80 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: cannot load blob %x: %s", entry.Oidscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/TreeEntry#Oid., err) |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | // If we couldn't find the blob, fail immediately. |
| 86 | if blob == nil { |
| 87 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: blob at %s in %s does not exist", path, tree) |
| 88 | } |
| 89 | |
| 90 | // Perform an assertion on the blob's contents. |
| 91 | got, err := ioscip-go gomod github.com/golang/go/src go1.25.0 io/.ReadAllscip-go gomod github.com/golang/go/src go1.25.0 io/ReadAll().(blob.Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents.) |
| 92 | if err != nil { |
| 93 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: cannot read contents from blob %s: %s", path, err) |
| 94 | } |
| 95 | |
| 96 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, contents, string(got)) |
| 97 | } |
| 98 | |
| 99 | // AssertCommitParent asserts that the given commit has a parent equivalent to |
| 100 | // the one provided. |
| 101 | func AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, db *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.ObjectDatabasescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#, sha, parent string) { |
| 102 | commit, err := db.Commitscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#Commit().(HexDecodescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/HexDecode().(t, sha)) |
| 103 | if err != nil { |
| 104 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: expected to read commit: %s, couldn't: %v", sha, err) |
| 105 | } |
| 106 | |
| 107 | decoded, err := hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.DecodeStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/DecodeString().(parent) |
| 108 | if err != nil { |
| 109 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: expected to decode parent SHA: %s, couldn't: %v", parent, err) |
| 110 | } |
| 111 | |
| 112 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, commit.ParentIDsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Commit#ParentIDs., decoded, |
| 113 | "gitobj: expected parents of commit: %s to contain: %s", sha, parent) |
| 114 | } |
| 115 | |
| 116 | // AssertCommitTree asserts that the given commit has a tree equivalent to the |
| 117 | // one provided. |
| 118 | func AssertCommitTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitTree().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, db *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.ObjectDatabasescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#, sha, tree string) { |
| 119 | commit, err := db.Commitscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#Commit().(HexDecodescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/HexDecode().(t, sha)) |
| 120 | if err != nil { |
| 121 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: expected to read commit: %s, couldn't: %v", sha, err) |
| 122 | } |
| 123 | |
| 124 | decoded, err := hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.DecodeStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/DecodeString().(tree) |
| 125 | if err != nil { |
| 126 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: expected to decode tree SHA: %s, couldn't: %v", tree, err) |
| 127 | } |
| 128 | |
| 129 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, decoded, commit.TreeIDscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Commit#TreeID., "gitobj: expected tree ID: %s (got: %x)", tree, commit.TreeIDscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Commit#TreeID.) |
| 130 | } |
| 131 | |
| 132 | // AssertRef asserts that a given refname points at the expected commit. |
| 133 | func AssertRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertRef().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, db *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.ObjectDatabasescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#, ref string, expected []byte) { |
| 134 | root, ok := db.Rootscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#Root().() |
| 135 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, ok, "gitobj: expected *odb.ObjectDatabase to have Root()") |
| 136 | |
| 137 | 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", "rev-parse", ref) |
| 138 | cmd.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = root |
| 139 | out, err := cmd.Outputscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Output().() |
| 140 | |
| 141 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 142 | |
| 143 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 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().(expected), stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(string(out))) |
| 144 | } |
| 145 | |
| 146 | // HexDecode decodes the given ASCII hex-encoded string into []byte's, or fails |
| 147 | // the test immediately if the given "sha" wasn't a valid hex-encoded sequence. |
| 148 | func HexDecodescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/HexDecode().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, sha string) []byte { |
| 149 | b, err := hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.DecodeStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/DecodeString().(sha) |
| 150 | if err != nil { |
| 151 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("gitobj: could not decode string: %q, %v", sha, err) |
| 152 | } |
| 153 | |
| 154 | return b |
| 155 | } |
| 156 | |
| 157 | // copyToTmp copies the given fixture to a folder in /tmp. |
| 158 | func copyToTmpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/copyToTmp().(fixture string) (string, error) { |
| 159 | p, 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().("", 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-lfs-fixture-%s", 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().(fixture))) |
| 160 | if err != nil { |
| 161 | return "", err |
| 162 | } |
| 163 | |
| 164 | if err = copyDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/copyDir().(fixture, p); err != nil { |
| 165 | return "", err |
| 166 | } |
| 167 | return p, nil |
| 168 | } |
| 169 | |
| 170 | // copyDir copies a directory (and recursively all files and subdirectories) |
| 171 | // from "from" to "to" preserving permissions and ownership. |
| 172 | func copyDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/copyDir().(from, to string) error { |
| 173 | stat, 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().(from) |
| 174 | if err != nil { |
| 175 | return err |
| 176 | } |
| 177 | |
| 178 | if err := 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().(to, stat.Modescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileInfo#Mode().()); err != nil { |
| 179 | return err |
| 180 | } |
| 181 | |
| 182 | entries, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.ReadDirscip-go gomod github.com/golang/go/src go1.25.0 os/ReadDir().(from) |
| 183 | if err != nil { |
| 184 | return err |
| 185 | } |
| 186 | |
| 187 | for _, entry := range entries { |
| 188 | sp := 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().(from, entry.Namescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/DirEntry#Name().()) |
| 189 | dp := 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().(to, entry.Namescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/DirEntry#Name().()) |
| 190 | |
| 191 | if entry.IsDirscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/DirEntry#IsDir().() { |
| 192 | err = copyDirscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/copyDir().(sp, dp) |
| 193 | } else { |
| 194 | err = copyFilescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/copyFile().(sp, dp) |
| 195 | } |
| 196 | |
| 197 | if err != nil { |
| 198 | return err |
| 199 | } |
| 200 | } |
| 201 | return nil |
| 202 | } |
| 203 | |
| 204 | // copyFile copies a file from "from" to "to" preserving permissions and |
| 205 | // ownership. |
| 206 | func copyFilescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/copyFile().(from, to string) error { |
| 207 | src, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Openscip-go gomod github.com/golang/go/src go1.25.0 os/Open().(from) |
| 208 | if err != nil { |
| 209 | return err |
| 210 | } |
| 211 | defer src.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 212 | |
| 213 | dst, 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().(to) |
| 214 | if err != nil { |
| 215 | return err |
| 216 | } |
| 217 | defer dst.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 218 | |
| 219 | if _, err = ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Copyscip-go gomod github.com/golang/go/src go1.25.0 io/Copy().(dst, src); err != nil { |
| 220 | return err |
| 221 | } |
| 222 | |
| 223 | stat, 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().(from) |
| 224 | if err != nil { |
| 225 | return err |
| 226 | } |
| 227 | |
| 228 | return osscip-go gomod github.com/golang/go/src go1.25.0 os/.Chmodscip-go gomod github.com/golang/go/src go1.25.0 os/Chmod().(to, stat.Modescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileInfo#Mode().()) |
| 229 | } |