def pack_object_header(type_num, delta_base, size):
 header = []
 c = ((type_num << 4) | (size & 15))
 size >>= 4
 while size:
  header.append((c | 128))
  c = (size & 127)
  size >>= 7
 header.append(c)
 if (type_num == OFS_DELTA):
  ret = [(delta_base & 127)]
  delta_base >>= 7
  while delta_base:
   delta_base -= 1
   ret.insert(0, (128 | (delta_base & 127)))
   delta_base >>= 7
  header.extend(ret)
 elif (type_num == REF_DELTA):
  assert (len(delta_base) == 20)
  header += delta_base
 return bytearray(header)

def pack_object_header ( type_num , delta_base , size ) : header = [ ] c = ( ( type_num << 4 ) | ( size & 15 ) ) size >>= 4 while size : header . append ( ( c | 128 ) ) c = ( size & 127 ) size >>= 7 header . append ( c ) if ( type_num == OFS_DELTA ) : ret = [ ( delta_base & 127 ) ] delta_base >>= 7 while delta_base : delta_base -= 1 ret . insert ( 0 , ( 128 | ( delta_base & 127 ) ) ) delta_base >>= 7 header . extend ( ret ) elif ( type_num == REF_DELTA ) : assert ( len ( delta_base ) == 20 ) header += delta_base return bytearray ( header )
create a pack object header for the given object info .