Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pack/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"io"
)

const maxHashSize = sha256.Size
const MaxHashSize = sha256.Size

// Index stores information about the location of objects in a corresponding
// packfile.
Expand Down
2 changes: 1 addition & 1 deletion pack/index_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type V1 struct {
// Name implements IndexVersion.Name by returning the 20 byte SHA-1 object name
// for the given entry at offset "at" in the v1 index file "idx".
func (v *V1) Name(idx *Index, at int64) ([]byte, error) {
var sha [maxHashSize]byte
var sha [MaxHashSize]byte

hashlen := v.hash.Size()

Expand Down
2 changes: 1 addition & 1 deletion pack/index_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type V2 struct {
// Name implements IndexVersion.Name by returning the 20 byte SHA-1 object name
// for the given entry at offset "at" in the v2 index file "idx".
func (v *V2) Name(idx *Index, at int64) ([]byte, error) {
var sha [maxHashSize]byte
var sha [MaxHashSize]byte

hashlen := v.hash.Size()

Expand Down
2 changes: 1 addition & 1 deletion pack/packfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (p *Packfile) findBase(typ PackedObjectType, offset, objOffset int64) (Chai
// We assume that we have to read at least an object ID's worth (the
// hash length in the case of a OBJ_REF_DELTA, or greater than the
// length of the base offset encoded in an OBJ_OFS_DELTA).
var sha [32]byte
var sha [MaxHashSize]byte
if _, err := p.r.ReadAt(sha[:hashlen], offset); err != nil {
return nil, baseOffset, err
}
Expand Down
4 changes: 3 additions & 1 deletion tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"strconv"
"strings"
"syscall"

"github.com/git-lfs/gitobj/v2/pack"
)

// Tree encapsulates a Git tree object.
Expand Down Expand Up @@ -53,7 +55,7 @@ func (t *Tree) Decode(hash hash.Hash, from io.Reader, size int64) (n int, err er
n += len(fname)
fname = strings.TrimSuffix(fname, "\x00")

var sha [32]byte
var sha [pack.MaxHashSize]byte
if _, err = io.ReadFull(buf, sha[:hashlen]); err != nil {
return n, err
}
Expand Down