git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Denis Bueno" <dbueno@gmail.com>
To: "Jakub Narebski" <jnareb@gmail.com>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: Re: Recovering from repository corruption
Date: Tue, 10 Jun 2008 15:38:09 -0400	[thread overview]
Message-ID: <6dbd4d000806101238v2bb975abqd39916e45d4bf866@mail.gmail.com> (raw)
In-Reply-To: <m3abhtp42o.fsf@localhost.localdomain>

On Tue, Jun 10, 2008 at 13:55, Jakub Narebski <jnareb@gmail.com> wrote:
> Assume that history looks like this
>
>    ...---.---a---*---b---.---...
>
> where by '*' is marked corruped commit (commit shich tree contains
> corrupted blobs).
>
> First, you can check the commit message for '*' using git-cat-file or
> git-show, you can get the difference between 'a' and 'b' using
> "git diff a b".  When you know how repaired commit 'X' should look
> like, do something like:
>
>  $ git checkout -b <temp-branch> 'a'
>  $ <edit edit edit>
>  $ git commit
>
> Then history would look like this
>
>    ...---.---a---*---b---.---...
>               \
>                \-X
>
> Now with grafts make 'b' be a child of 'X', i.e. modify parent of 'b'
> for history to look like below:
>
>    ...---.---a---*   b---.---...
>               \     /
>                \-X-/
>
> Examine history using git-log, git-show, check tree with git-ls-tree
> and examining files, use graphical history browser like gitk.
>
> Then if possible use git-filter-branch to make history recorded in
> grafts file permanent...
>
> HTH
> --
> Jakub Narebski
> Poland
> ShadeHawk on #git
>

Thanks for the help.

My situation was:

    ...---a---*---b---c---d---*---e---...

Following your example, I believe I got this to:

    ...---a---*   b---c---d---*   e---...
           \     /         \     /
            \-X-/           \---/

That is, I replaced the first problematic commit and deleted the
second, since I forgot how I changed 'd' to get that commit.  I put
the following in .git/info/grafts:

    'b' X
    'e' 'd'

(which I gathered from here:
http://thread.gmane.org/gmane.comp.version-control.git/66398/focus=66402.
 I've never use grafts before.  A bit about them should be put in the
manual, if it's not there already. =])

Then I ran:

    git-filter-branch HEAD ^X ^'d'

Now "git log --raw --all" doesn't show any of the problematic SHA-1
hashes anymore!

However:

identity.fb[173] > git fsck --full
    error: 320bd6e82267b71dd2ca7043ea3f61dbbca16109: object corrupt or missing
    error: 4d0be2816d5eea5ae2b40990235e2225c1715927: object corrupt or missing
    missing blob 320bd6e82267b71dd2ca7043ea3f61dbbca16109
    missing blob 4d0be2816d5eea5ae2b40990235e2225c1715927

Shouldn't these be unreferenced now that I've run filter-branch?

-- 
                              Denis

  reply	other threads:[~2008-06-10 19:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-10 17:26 Recovering from repository corruption Denis Bueno
2008-06-10 17:55 ` Jakub Narebski
2008-06-10 19:38   ` Denis Bueno [this message]
2008-06-10 19:59     ` Jakub Narebski
2008-06-10 20:03       ` Denis Bueno
2008-06-10 20:14         ` Jakub Narebski
2008-06-10 20:35           ` Denis Bueno
2008-06-10 20:23         ` Linus Torvalds
2008-06-10 20:28           ` Denis Bueno
2008-06-10 21:09             ` Linus Torvalds
2008-06-10 21:22               ` Denis Bueno
2008-06-10 21:48                 ` Linus Torvalds
2008-06-10 22:09                   ` Denis Bueno
2008-06-10 22:25                     ` Tarmigan
2008-06-10 22:41                       ` Denis Bueno
2008-06-10 22:45                     ` Linus Torvalds
2008-06-10 23:00                       ` Linus Torvalds
2008-06-11  0:43                       ` Nicolas Pitre
2008-06-11  1:39                         ` Linus Torvalds
2008-06-11  1:47                           ` Nicolas Pitre
2008-06-10 21:27               ` Denis Bueno
2008-06-10 22:52               ` Junio C Hamano
2008-06-11 23:21               ` To graft or not to graft... (Re: Recovering from repository corruption) Stephen R. van den Berg
2008-06-11 23:34                 ` Jakub Narebski
2008-06-11 23:39                 ` Linus Torvalds
2008-06-12  7:14                   ` Johan Herland
2008-06-12  7:47                     ` Jeff King
2008-06-12 10:21                       ` Johan Herland
2008-06-12 12:20                         ` Stephen R. van den Berg
2008-06-10 19:40 ` Recovering from repository corruption Nicolas Pitre
2008-06-10 19:42   ` Denis Bueno

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=6dbd4d000806101238v2bb975abqd39916e45d4bf866@mail.gmail.com \
    --to=dbueno@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    /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).