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

Re: Error:non-monotonic index after failed recursive "sed" command

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 14, 2013, 19:06 UTC
Message-ID
<7v622zbn3s.fsf@alter.siamese.dyndns.org>
In-Reply-To
<50F3F852.8060800@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 24 quoted lines
> Am 1/14/2013 12:40, schrieb George Karpenkov:
>> I've managed to corrupt my very valuable repository with a recursive
>> sed which went wrong.
>> I wanted to convert all tabs to spaces with the following command:
>> 
>> find ./ -name '*.*' -exec sed -i 's/\t/    /g' {} \;
>> 
>> I think that has changed not only the files in the repo, but the data
>> files in .git directory itself. As a result, my index became
>> corrupted, and almost every single command dies:
>> 
>>> git log
>> error: non-monotonic index
>> ..git/objects/pack/pack-314b1944adebea645526b6724b2044c1313241f5.idx
>> error: non-monotonic index
>> ..git/objects/pack/pack-75c95b0defe1968b61e4f4e1ab7040d35110bfdc.idx
>> ....
> ...
> Try the reverse edit:
>
>  find .git -name '*.*' -exec sed -i 's/    /\t/g' {} \;
>
> Remove .git/index; it can be reconstructed (of course, assuming you
> started all this with a clean index; if not, you lose the staged changes).

Everybody seems to be getting an impression that .idx is the only thing that got corrupt. Where does that come from?

I do not see anything that prevents the original command line from touching *.pack files. Loose objects may have been left unmolested as their names do not match '*.*', though.

Previous: Johannes SixtNext: Matthieu Moy
Message 5 of 9 in “Error:non-monotonic index after failed recursive "sed" command”
  1. George KarpenkovJan 14, 2013
  2. Matthieu MoyJan 14, 2013
  3. John KeepingJan 14, 2013
  4. Johannes SixtJan 14, 2013
  5. Junio C HamanoJan 14, 2013
  6. Matthieu MoyJan 14, 2013
  7. George KarpenkovJan 14, 2013
  8. Philip OakleyJan 14, 2013
  9. George KarpenkovJan 15, 2013

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.