···1717 "time"
18181919 "github.com/c2h5oh/datasize"
2020+ "github.com/go-git/go-git/v6/plumbing"
2121+ format "github.com/go-git/go-git/v6/plumbing/format/config"
2022 "github.com/klauspost/compress/zstd"
2123 "github.com/prometheus/client_golang/prometheus"
2224 "github.com/prometheus/client_golang/prometheus/promauto"
···103105}
104106105107func AddFile(manifest *Manifest, path string, data []byte) *Entry {
108108+ // Fill in `git_hash` even for files not originating from git using the SHA256 algorithm;
109109+ // we use this primarily for incremental archive uploads, but when support for git SHA256
110110+ // repositories is complete, archive uploads and git checkouts will have cross-support for
111111+ // incremental updates.
112112+ hasher := plumbing.NewHasher(format.SHA256, plumbing.BlobObject, int64(len(data)))
113113+ hasher.Write(data)
106114 entry := NewManifestEntry(Type_InlineFile, data)
115115+ entry.GitHash = proto.String(hasher.Sum().String())
107116 manifest.Contents[path] = entry
108117 return entry
109118}