diff options
author | Santiago M. Mola <santi@mola.io> | 2016-11-25 15:48:20 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-11-25 15:48:20 +0100 |
commit | f9adb3565b36ba1573102f954d0ee916009efac2 (patch) | |
tree | abc5b98e61b5851a985a215f7265ce2e9eb131f7 /plumbing/protocol/packp/advrefs.go | |
parent | c1e0932c6cbcc55a78f338d437b9f13d89f33552 (diff) | |
download | go-git-f9adb3565b36ba1573102f954d0ee916009efac2.tar.gz |
move: format/packp -> protocol/packp (#141)
* move: format/packp -> protocol/packp
* format/packp -> protocol/packp
* format/packp/pktline -> format/pktline.
* move: protocol/packp/ulreq/* -> protocol/packp/*
* protocol/packp: rename UlReq types to make them unique.
* * protocol/packp: namespace UlReq encoder.
* protocol/packp: namespace UlReq decoder.
* protocol/packp: fix example names
* move: protocol/packp/advrefs/* -> protocol/packp/*
* further ulreq namespacing
* protocol/packp: namespace AdvRefs types.
Diffstat (limited to 'plumbing/protocol/packp/advrefs.go')
-rw-r--r-- | plumbing/protocol/packp/advrefs.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/plumbing/protocol/packp/advrefs.go b/plumbing/protocol/packp/advrefs.go new file mode 100644 index 0000000..c54f9d8 --- /dev/null +++ b/plumbing/protocol/packp/advrefs.go @@ -0,0 +1,40 @@ +package packp + +import ( + "gopkg.in/src-d/go-git.v4/plumbing" +) + +// AdvRefs values represent the information transmitted on an +// advertised-refs message. Values from this type are not zero-value +// safe, use the New function instead. +// +// When using this messages over (smart) HTTP, you have to add a pktline +// before the whole thing with the following payload: +// +// '# service=$servicename" LF +// +// Moreover, some (all) git HTTP smart servers will send a flush-pkt +// just after the first pkt-line. +// +// To accomodate both situations, the Prefix field allow you to store +// any data you want to send before the actual pktlines. It will also +// be filled up with whatever is found on the line. +type AdvRefs struct { + Prefix [][]byte // payloads of the prefix + Head *plumbing.Hash + Capabilities *Capabilities + References map[string]plumbing.Hash + Peeled map[string]plumbing.Hash + Shallows []plumbing.Hash +} + +// NewAdvRefs returns a pointer to a new AdvRefs value, ready to be used. +func NewAdvRefs() *AdvRefs { + return &AdvRefs{ + Prefix: [][]byte{}, + Capabilities: NewCapabilities(), + References: make(map[string]plumbing.Hash), + Peeled: make(map[string]plumbing.Hash), + Shallows: []plumbing.Hash{}, + } +} |