diff options
author | Antonio Navarro Perez <antnavper@gmail.com> | 2016-11-24 15:15:59 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-11-24 15:15:59 +0100 |
commit | 81c5d2c6c672509ee7f30a346b890f3920ff20c1 (patch) | |
tree | 741dc07f3b083a1184bc0ced96677bcf93884186 /plumbing/format/packfile/scanner.go | |
parent | 08e08d771ef03df80248c80d81475fe7c5ea6fe7 (diff) | |
download | go-git-81c5d2c6c672509ee7f30a346b890f3920ff20c1.tar.gz |
plumbing/packfile: PACK encoder (#131)
* plumbing/packfile: PACK encoder
- Added simple PACK encoder, deltas not supported by now
* Requested changes
* Requested changes
* Requested changes
Diffstat (limited to 'plumbing/format/packfile/scanner.go')
-rw-r--r-- | plumbing/format/packfile/scanner.go | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/plumbing/format/packfile/scanner.go b/plumbing/format/packfile/scanner.go index 130bb94..3adc26a 100644 --- a/plumbing/format/packfile/scanner.go +++ b/plumbing/format/packfile/scanner.go @@ -26,11 +26,6 @@ var ( ErrSeekNotSupported = NewError("not seek support") ) -const ( - // VersionSupported is the packfile version supported by this parser. - VersionSupported uint32 = 2 -) - // ObjectHeader contains the information related to the object, this information // is collected from the previous bytes to the content of the object. type ObjectHeader struct { @@ -124,7 +119,7 @@ func (s *Scanner) readSignature() ([]byte, error) { // isValidSignature returns if sig is a valid packfile signature. func (s *Scanner) isValidSignature(sig []byte) bool { - return bytes.Equal(sig, []byte{'P', 'A', 'C', 'K'}) + return bytes.Equal(sig, signature) } // readVersion reads and returns the version field of a packfile. @@ -230,15 +225,6 @@ func (s *Scanner) readObjectTypeAndLength() (plumbing.ObjectType, int64, error) return t, l, err } -const ( - maskType = uint8(112) // 0111 0000 - maskFirstLength = uint8(15) // 0000 1111 - maskContinue = uint8(128) // 1000 000 - firstLengthBits = uint8(4) // the first byte has 4 bits to store the length - maskLength = uint8(127) // 0111 1111 - lengthBits = uint8(7) // subsequent bytes has 7 bits to store the length -) - func (s *Scanner) readType() (plumbing.ObjectType, byte, error) { var c byte var err error |