title: How can git differentiate deltified pack record types?
body: <p>In a pack file there are records, which according to <a href="https://codewords.recurse.com/issues/three/unpacking-git-packfiles" rel="nofollow noreferrer">this</a> post have the type stored in the header, along with some other metadata.</p>
  
  <p>Looking at the <a href="https://github.com/eclipse/jgit/blob/8a6af368c4129ef35520ec72cc9f55a3f685bfb8/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java#L139" rel="nofollow noreferrer">JGit source</a> I can see the following values.</p>
  
  <ul>
  <li>0 - EXTENDED</li>
  <li>1 - COMMIT</li>
  <li>2 - TREE</li>
  <li>3 - BLOB</li>
  <li>4 - TAG</li>
  <li>5 - RESERVED</li>
  <li>6 - OFS_DELTA</li>
  <li>7 - REF_DELTA</li>
  </ul>
  
  <p>However, if the object is deltified then the type in the header will be set to 6 or 7, and after that there seems to be no added header showing the type of the payload, just some method of getting the original and then the delta data.</p>
  
  <p>How can git tell the type of a deltified pack record, so that it doesn't mix up types?</p>