git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: George Karpenkov <george@metaworld.ru>, git <git@vger.kernel.org>
Subject: Re: Error:non-monotonic index after failed recursive "sed" command
Date: Mon, 14 Jan 2013 11:06:47 -0800	[thread overview]
Message-ID: <7v622zbn3s.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <50F3F852.8060800@viscovery.net> (Johannes Sixt's message of "Mon, 14 Jan 2013 13:21:38 +0100")

Johannes Sixt <j.sixt@viscovery.net> writes:

> 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.

  reply	other threads:[~2013-01-14 19:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 11:40 Error:non-monotonic index after failed recursive "sed" command George Karpenkov
2013-01-14 12:06 ` Matthieu Moy
2013-01-14 12:12   ` John Keeping
2013-01-14 12:21 ` Johannes Sixt
2013-01-14 19:06   ` Junio C Hamano [this message]
2013-01-14 19:13     ` Matthieu Moy
2013-01-14 22:57       ` George Karpenkov
2013-01-14 23:45         ` Philip Oakley
2013-01-15  0:54           ` George Karpenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v622zbn3s.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=george@metaworld.ru \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).