From 81c5d2c6c672509ee7f30a346b890f3920ff20c1 Mon Sep 17 00:00:00 2001 From: Antonio Navarro Perez Date: Thu, 24 Nov 2016 15:15:59 +0100 Subject: plumbing/packfile: PACK encoder (#131) * plumbing/packfile: PACK encoder - Added simple PACK encoder, deltas not supported by now * Requested changes * Requested changes * Requested changes --- plumbing/format/packfile/scanner.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'plumbing/format/packfile/scanner.go') 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 -- cgit