git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Analyzing a corrupted index file

From
NMNathan 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

Next: Junio C Hamano
Message 1 of 4 in “Analyzing a corrupted index file”
  1. Nathan Manceaux-PanotJan 7, 2024
  2. Junio C HamanoJan 8, 2024
  3. Nathan Manceaux-PanotJan 9, 2024
  4. Junio C HamanoJan 9, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.