aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/format')
-rw-r--r--plumbing/format/idxfile/decoder.go8
-rw-r--r--plumbing/format/index/decoder_test.go8
-rw-r--r--plumbing/format/index/index.go4
3 files changed, 11 insertions, 9 deletions
diff --git a/plumbing/format/idxfile/decoder.go b/plumbing/format/idxfile/decoder.go
index 020c997..c1269a1 100644
--- a/plumbing/format/idxfile/decoder.go
+++ b/plumbing/format/idxfile/decoder.go
@@ -57,7 +57,7 @@ func (d *Decoder) Decode(idx *Idxfile) error {
func validateHeader(r io.Reader) error {
var h = make([]byte, 4)
- if _, err := r.Read(h); err != nil {
+ if _, err := io.ReadFull(r, h); err != nil {
return err
}
@@ -99,7 +99,7 @@ func readObjectNames(idx *Idxfile, r io.Reader) error {
c := int(idx.ObjectCount)
for i := 0; i < c; i++ {
var ref plumbing.Hash
- if _, err := r.Read(ref[:]); err != nil {
+ if _, err := io.ReadFull(r, ref[:]); err != nil {
return err
}
@@ -135,11 +135,11 @@ func readOffsets(idx *Idxfile, r io.Reader) error {
}
func readChecksums(idx *Idxfile, r io.Reader) error {
- if _, err := r.Read(idx.PackfileChecksum[:]); err != nil {
+ if _, err := io.ReadFull(r, idx.PackfileChecksum[:]); err != nil {
return err
}
- if _, err := r.Read(idx.IdxChecksum[:]); err != nil {
+ if _, err := io.ReadFull(r, idx.IdxChecksum[:]); err != nil {
return err
}
diff --git a/plumbing/format/index/decoder_test.go b/plumbing/format/index/decoder_test.go
index 1ffbe75..3a6e0d4 100644
--- a/plumbing/format/index/decoder_test.go
+++ b/plumbing/format/index/decoder_test.go
@@ -3,9 +3,11 @@ package index
import (
"testing"
- . "gopkg.in/check.v1"
- "github.com/src-d/go-git-fixtures"
"srcd.works/go-git.v4/plumbing"
+ "srcd.works/go-git.v4/plumbing/filemode"
+
+ "github.com/src-d/go-git-fixtures"
+ . "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
@@ -53,7 +55,7 @@ func (s *IndexSuite) TestDecodeEntries(c *C) {
c.Assert(e.Size, Equals, uint32(189))
c.Assert(e.Hash.String(), Equals, "32858aad3c383ed1ff0a0f9bdf231d54a00c9e88")
c.Assert(e.Name, Equals, ".gitignore")
- c.Assert(e.Mode.String(), Equals, "-rw-r--r--")
+ c.Assert(e.Mode, Equals, filemode.Regular)
e = idx.Entries[1]
c.Assert(e.Name, Equals, "CHANGELOG")
diff --git a/plumbing/format/index/index.go b/plumbing/format/index/index.go
index a95dba2..e706058 100644
--- a/plumbing/format/index/index.go
+++ b/plumbing/format/index/index.go
@@ -2,10 +2,10 @@ package index
import (
"errors"
- "os"
"time"
"srcd.works/go-git.v4/plumbing"
+ "srcd.works/go-git.v4/plumbing/filemode"
)
var (
@@ -62,7 +62,7 @@ type Entry struct {
// Dev and Inode of the tracked path
Dev, Inode uint32
// Mode of the path
- Mode os.FileMode
+ Mode filemode.FileMode
// UID and GID, userid and group id of the owner
UID, GID uint32
// Size is the length in bytes for regular files