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

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

From
John Keeping <john@keeping.me.uk>
Date
Jan 14, 2013, 12:12 UTC
Message-ID
<20130114121247.GS4574@serenity.lan>
In-Reply-To
<vpq38y42clj.fsf@grenoble-inp.fr>
On Mon, Jan 14, 2013 at 01:06:16PM +0100, Matthieu Moy wrote:
Show 13 quoted lines
> George Karpenkov <george@metaworld.ru> writes:
>> 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.

Having backed up the corrupt state, another option is to just try running the reverse command:

find .git -name '*.*' -exec sed -i 's/    /\t/g' {} \;

I had a quick grep over some pack indices here and ' ' doesn't occur in any of mine whereas '\t' is very common so you may find that the only ' ' sequences are the ones you introduced.

John
Previous: Matthieu MoyNext: Johannes Sixt
Message 3 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.