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

Recovering from repository corruption

From
Denis Bueno <dbueno@gmail.com>
Date
Jun 10, 2008, 17:26 UTC
Message-ID
<6dbd4d000806101026m458513ecqa8141f509bad7602@mail.gmail.com>

I started a thread a while back about repository corruption. It manifested as a clone error and the thread is here:

    http://kerneltrap.org/mailarchive/git/2007/7/31/253475

I just ran, again, into corruption after my laptop kernel-panic'd. (Ironically, at the moment I ran into the corruption I was trying to push my repo to a backup location.) Since that thread took place it seems a section about recovering from repo corruption was added to the manual --- but it assumes you can (or care to painstakingly) recreate each corrupted version.

I made several changes to one file, home.html, and now have the following corruption:

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

I know which commits these hashes correspond to, and I know roughly what I did in those commits, but, I really don't care that much, and anyway it will be painful to recreate them because of whitespace/formatting issues. Here are the commits, in case it is relevant:

    commit 163a93df14d246dee91c3a503e6372b8313f337d
    Author: Denis Bueno <dbueno@gmail.com>
    Date:   Tue Jun 10 09:45:41 2008 -0400
        Add lambda-the-ultimate link
    :100644 100644 320bd6e... 2ab4775... M  home.html
    [... intervenent commits ...]
    commit 4737fea59fdc8325e09b5206cc7a6ac593446ce3
    Author: Denis Bueno <dbueno@gmail.com>
    Date:   Tue Jun 10 09:37:12 2008 -0400
        Hoogle up top too
    :100644 100644 4d0be28... c6fe111... M  home.html
Assuming I can't recreate the hashed files, what are my options?

I was told in the thread above that I could use grafts and "git filter-branch" to create a new repository that simply got rid of the offending object. That case was simpler, as it was the initial import of a file that had only two commits total that was corrupted. However, in this case there are changes between the initial and latest version of the file, and commits between the corrupted versions, so, I can imagine that it would be hard to get rid of in-between commits.

The thing that makes sense intuitively (read: not as a Git expert, but
as a user) is to just let me replace the commits associated with the
problematic objects with new versions of those commits (e.g. make
change described in the commit message, which is different from the
actual change that was recorded, due to whitespace/formatting issues).
 Is this what I should do?  And to do so, should I be reading chapter
5 of the manual?
Thanks.
-- 
                              Denis
Next: Jakub Narebski
Message 1 of 31 in “Recovering from repository corruption”
  1. Denis BuenoJun 10, 2008
  2. Jakub NarebskiJun 10, 2008
  3. Denis BuenoJun 10, 2008
  4. Jakub NarebskiJun 10, 2008
  5. Denis BuenoJun 10, 2008
  6. Jakub NarebskiJun 10, 2008
  7. Denis BuenoJun 10, 2008
  8. Linus TorvaldsJun 10, 2008
  9. Denis BuenoJun 10, 2008
  10. Linus TorvaldsJun 10, 2008
  11. Denis BuenoJun 10, 2008
  12. Linus TorvaldsJun 10, 2008
  13. Denis BuenoJun 10, 2008
  14. TarmiganJun 10, 2008
  15. Denis BuenoJun 10, 2008
  16. Linus TorvaldsJun 10, 2008
  17. Linus TorvaldsJun 10, 2008
  18. Nicolas PitreJun 11, 2008
  19. Linus TorvaldsJun 11, 2008
  20. Nicolas PitreJun 11, 2008
  21. Denis BuenoJun 10, 2008
  22. Junio C HamanoJun 10, 2008
  23. To graft or not to graft... (Re: Recovering from repository corruption)Stephen R. van den Berg, Jun 11, 2008
  24. Jakub NarebskiJun 11, 2008
  25. Linus TorvaldsJun 11, 2008
  26. Johan HerlandJun 12, 2008
  27. Jeff KingJun 12, 2008
  28. Johan HerlandJun 12, 2008
  29. Stephen R. van den BergJun 12, 2008
  30. Nicolas PitreJun 10, 2008
  31. Denis BuenoJun 10, 2008

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.