From: John Keeping Date: Mon, 14 Jan 2013 12:12:47 GMT Subject: Re: Error:non-monotonic index after failed recursive "sed" command Message-ID: <20130114121247.GS4574@serenity.lan> In-Reply-To: On Mon, Jan 14, 2013 at 01:06:16PM +0100, Matthieu Moy wrote: > George Karpenkov 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