MCPcopy Index your code
hub / github.com/go-git/go-git / Encode

Method Encode

plumbing/format/packfile/encoder.go:49–59  ·  view source on GitHub ↗

Encode creates a packfile containing all the objects referenced in hashes and writes it to the writer in the Encoder. `packWindow` specifies the size of the sliding window used to compare objects for delta compression; 0 turns off delta compression entirely.

(
	hashes []plumbing.Hash,
	packWindow uint,
)

Source from the content-addressed store, hash-verified

47// specifies the size of the sliding window used to compare objects
48// for delta compression; 0 turns off delta compression entirely.
49func (e *Encoder) Encode(
50 hashes []plumbing.Hash,
51 packWindow uint,
52) (plumbing.Hash, error) {
53 objects, err := e.selector.ObjectsToPack(hashes, packWindow)
54 if err != nil {
55 return plumbing.ZeroHash, err
56 }
57
58 return e.encode(objects)
59}
60
61func (e *Encoder) encode(objects []*ObjectToPack) (plumbing.Hash, error) {
62 if err := e.head(len(objects)); err != nil {

Callers 1

testEncodeDecodeMethod · 0.95

Calls 2

encodeMethod · 0.95
ObjectsToPackMethod · 0.80

Tested by 1

testEncodeDecodeMethod · 0.76