fork of whitequark.org/git-pages with mods for tangled

Simplify. NFCI

Co-authored-by: David Leadbeater <dgl@dgl.cx>

Changed files
+2 -19
src
+2 -1
src/fetch.go
··· 146 for _, oldManifestEntry := range oldManifest.GetContents() { 147 if hash, ok := plumbing.FromHex(oldManifestEntry.GetGitHash()); ok { 148 if manifestEntry, found := blobsNeeded[hash]; found { 149 - CopyProtoMessage(manifestEntry, oldManifestEntry) 150 dataBytesFromOldManifest += oldManifestEntry.GetOriginalSize() 151 delete(blobsNeeded, hash) 152 }
··· 146 for _, oldManifestEntry := range oldManifest.GetContents() { 147 if hash, ok := plumbing.FromHex(oldManifestEntry.GetGitHash()); ok { 148 if manifestEntry, found := blobsNeeded[hash]; found { 149 + manifestEntry.Reset() 150 + proto.Merge(manifestEntry, oldManifestEntry) 151 dataBytesFromOldManifest += oldManifestEntry.GetOriginalSize() 152 delete(blobsNeeded, hash) 153 }
-18
src/util.go
··· 4 "errors" 5 "io" 6 "strings" 7 - 8 - "google.golang.org/protobuf/proto" 9 ) 10 11 type BoundedReader struct { ··· 87 mediaType = strings.TrimSpace(strings.ToLower(mediaType)) 88 return 89 } 90 - 91 - // Copying Protobuf messages like `*dest = *src` causes a lock to be copied, which is unsound. 92 - // Copying Protobuf messages field-wise is fragile: adding a new field to the schema does not 93 - // cause a diagnostic to be emitted pointing to the copy site, making it easy to miss updates. 94 - // Serializing and deserializing is reliable and breaks referential links. 95 - func CopyProtoMessage(dest, src proto.Message) { 96 - data, err := proto.Marshal(src) 97 - if err != nil { 98 - panic(err) 99 - } 100 - 101 - err = proto.Unmarshal(data, dest) 102 - if err != nil { 103 - panic(err) 104 - } 105 - }
··· 4 "errors" 5 "io" 6 "strings" 7 ) 8 9 type BoundedReader struct { ··· 85 mediaType = strings.TrimSpace(strings.ToLower(mediaType)) 86 return 87 }