aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/index/decoder.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-11-19 15:40:26 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2018-11-19 15:40:26 +0100
commitb99653a9d3d231a9e1e4a1ddca41a08b3b733ae9 (patch)
tree110a980b1d91ddffdb9a156edc32d3b516aebec3 /plumbing/format/index/decoder.go
parenta779a263330bc497181136072e7a484fefb51323 (diff)
downloadgo-git-b99653a9d3d231a9e1e4a1ddca41a08b3b733ae9.tar.gz
plumbing: format/index: support for EOIE extension, by default on git v2.2.0
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Diffstat (limited to 'plumbing/format/index/decoder.go')
-rw-r--r--plumbing/format/index/decoder.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/plumbing/format/index/decoder.go b/plumbing/format/index/decoder.go
index df25530..ac57d08 100644
--- a/plumbing/format/index/decoder.go
+++ b/plumbing/format/index/decoder.go
@@ -261,6 +261,17 @@ func (d *Decoder) readExtension(idx *Index, header []byte) error {
if err := d.Decode(idx.ResolveUndo); err != nil {
return err
}
+ case bytes.Equal(header, endOfIndexEntryExtSignature):
+ r, err := d.getExtensionReader()
+ if err != nil {
+ return err
+ }
+
+ idx.EndOfIndexEntry = &EndOfIndexEntry{}
+ d := &endOfIndexEntryDecoder{r}
+ if err := d.Decode(idx.EndOfIndexEntry); err != nil {
+ return err
+ }
default:
return errUnknownExtension
}
@@ -449,3 +460,17 @@ func (d *resolveUndoDecoder) readStage(e *ResolveUndoEntry, s Stage) error {
return nil
}
+
+type endOfIndexEntryDecoder struct {
+ r io.Reader
+}
+
+func (d *endOfIndexEntryDecoder) Decode(e *EndOfIndexEntry) error {
+ var err error
+ e.Offset, err = binary.ReadUint32(d.r)
+ if err != nil {
+ return err
+ }
+
+ return binary.Read(d.r, &e.Hash)
+}