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

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

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jan 14, 2013, 12:06 UTC
Message-ID
<vpq38y42clj.fsf@grenoble-inp.fr>
In-Reply-To
<CAMoGvRKkSZqcoGtiebu6tuPndzOjQ1=JgQHb+iusAHpUbA2HbA@mail.gmail.com>
George Karpenkov <george@metaworld.ru> writes:
Show 7 quoted lines
> Hi All,
>
> 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' {} \;

Clearly, this is a dangerous command as it impacts .git/. However, Git partially protects you from this kind of error, since object files and pack files are read-only by default.

My obvious first advice is: make backups of your corrupted repository. Yes, I said backup_s_, better safe than sorry.

Then, the errors you get are in *.idx files, which are basically index for pack files, for quicker access. You can try removing these files, and then running "git index-pack" on each pack file, like

$ rm .git/objects/pack/pack-*.idx $ git index-pack .git/objects/pack/pack-4745076928ca4df932a3727b8cc25e83574560bb.pack 4745076928ca4df932a3727b8cc25e83574560bb $ git index-pack .git/objects/pack/pack-c74a6514f653d0269cdcdf9c1c102d326706bbda.pack c74a6514f653d0269cdcdf9c1c102d326706bbda

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: George KarpenkovNext: John Keeping
Message 2 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.