aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/idxfile/encoder.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-02-07 15:23:57 +0100
committerGitHub <noreply@github.com>2017-02-07 15:23:57 +0100
commit431af32445562b389397f3ee7af90bf61455fff1 (patch)
tree11ad4dfafd66e7f499307afb99a267d5d8763140 /plumbing/format/idxfile/encoder.go
parentd0cf20797464ab12b41ccb5c603f67884a6e8e17 (diff)
downloadgo-git-431af32445562b389397f3ee7af90bf61455fff1.tar.gz
package plumbing documentation improvements (#248)
Diffstat (limited to 'plumbing/format/idxfile/encoder.go')
-rw-r--r--plumbing/format/idxfile/encoder.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/plumbing/format/idxfile/encoder.go b/plumbing/format/idxfile/encoder.go
index 2b0ef89..374d053 100644
--- a/plumbing/format/idxfile/encoder.go
+++ b/plumbing/format/idxfile/encoder.go
@@ -9,20 +9,20 @@ import (
"srcd.works/go-git.v4/utils/binary"
)
-// An Encoder writes idx files to an output stream.
+// Encoder writes Idxfile structs to an output stream.
type Encoder struct {
io.Writer
hash hash.Hash
}
-// NewEncoder returns a new encoder that writes to w.
+// NewEncoder returns a new stream encoder that writes to w.
func NewEncoder(w io.Writer) *Encoder {
h := sha1.New()
mw := io.MultiWriter(w, h)
return &Encoder{mw, h}
}
-// Encode writes the idx in an idx file format to the stream of the encoder.
+// Encode encodes an Idxfile to the encoder writer.
func (e *Encoder) Encode(idx *Idxfile) (int, error) {
idx.Entries.Sort()
@@ -123,6 +123,7 @@ func (e *Encoder) encodeChecksums(idx *Idxfile) (int, error) {
return 40, nil
}
+// EntryList implements sort.Interface allowing sorting in increasing order.
type EntryList []Entry
func (p EntryList) Len() int { return len(p) }