Analyzing a corrupted index file
- From
- Nathan Manceaux-Panot <fresh.tree3651@lemon.garden>
- Date
- Jan 7, 2024, 15:22 UTC
- Message-ID
- <B38C5D82-33E3-4D10-8119-7E0D59DD3DA2@lemon.garden>
Hello all,
I have a corrupted git index file, and am trying to read it by hand, to understand what's wrong with it. Are there any tools that'll let me parse the on-disk, binary version of the index file, to unpack it into a human-readable data structure? I found the spec for the index binary format, but reading it in that way is beyond my abilities.
For context, I'm writing a git tool, and my code is causing the index file to be screwed up in some unknown way. When it's in that state, git (v2.43) becomes inconsistent with itself: - In the workdir, the file contains A - According to `git show :file`, the file in the index contains B - But `git diff` reports no changes! The inconsistency goes away with a simple `git reset`, but can then be easily reproduced by re-executing my tool.
Thank you, Nathan