Correctly skip over unrecognized optional dircache extensions
We didn't skip the correct number of bytes when we skipped over an
unrecognized but optional dircache extension. We missed skipping
the 8 byte header that makes up the extension's name and length.
We also didn't include the skipped extension's payload as part of
our index checksum, resuting in a checksum failure when the index
was done reading. So ensure we always scan through a skipped
section and include it in the checksum computation.
Add a test case for a currently unsupported index extension, 'ZZZZ',
to verify we can still read the DirCache object even though we
don't know what 'ZZZZ' is supposed to mean.
Bug: 301287
Change-Id: I4bdde94576fffe826d0782483fd98cab1ea628fa
Signed-off-by:
Shawn O. Pearce <spearce@spearce.org>
Showing
- org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/gitgit.index.ZZZZ 0 additions, 0 deletions...st-rsrc/org/eclipse/jgit/test/resources/gitgit.index.ZZZZ
- org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/gitgit.index.aaaa 0 additions, 0 deletions...st-rsrc/org/eclipse/jgit/test/resources/gitgit.index.aaaa
- org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/gitgit.index.badchecksum 0 additions, 0 deletions.../org/eclipse/jgit/test/resources/gitgit.index.badchecksum
- org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java 29 additions, 0 deletions.../eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
- org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java 41 additions, 11 deletionsorg.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
Loading
Please register or sign in to comment