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

Re: corrupt object on git-gc

From
YLYossi Leybovich <sleybo@gmail.com>
Date
Nov 9, 2007, 17:53 UTC
Message-ID
<4fe79b4b0711090953h5b06f7d4l2d17972630a4d355@mail.gmail.com>
In-Reply-To
<alpine.LFD.0.999.0711090758560.15101@woody.linux-foundation.org>
On Nov 9, 2007 11:28 AM, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> and you should now have a line that looks like
>
>        10064 blob 4b9458b3786228369c63936db65827de3cc06200     my-magic-file
That works and now I know the file
Show 31 quoted lines
>
> The easiest way to do it is to do
>
>        git log --raw --all --full-history -- subdirectory/my-magic-file
>
> and that will show you the whole log for that file (please realize that
> the tree you had may not be the top-level tree, so you need to figure out
> which subdirectory it was in on your own), and because you're asking for
> raw output, you'll now get something like
>
>        commit abc
>        Author:
>        Date:
>          ..
>        :100644 100644 4b9458b... newsha... M  somedirectory/my-magic-file
>
>
>        commit xyz
>        Author:
>        Date:
>
>          ..
>        :100644 100644 oldsha... 4b9458b... M   somedirectory/my-magic-file
>
> and this actually tells you what the *previous* and *subsequent* versions
> of that file were! So now you can look at those ("oldsha" and "newsha"
> respectively), and hopefully you have done commits often, and can
> re-create the missing my-magic-file version by looking at those older and
> newer versions!
>
> If you can do that, you can now recreate the missing object with
Ok, tried that and unfortuantly the SHA1 number is apear only one
[mellanox@mellanox-compile ib]$ git log --raw --all --full-history --
SymmK/St.c  | grep 4b9
:100755 100755 308806c... 4b9458b3786228369c63936db65827de3cc06200 M
 SymmK/St.c
git log --raw --all --full-history -- SymmK/St.c
...
...
commit 597e70e7dc8e06a7cdbe4d9e9727411c964bd023
Author: sleybo <sleybo@mellanox.co.il>
Date:   Fri Oct 5 10:41:43 2007 -0400
    1. increase QPs parameters - QP is bigger than 4k
    2. lock buffers use the dma key
    3. add prints
:100755 100755 308806c... 4b9458b3786228369c63936db65827de3cc06200 M
 SymmK/St.c

What intersting is that the SHA1 that I looked for apear only once (only as new SHA1)

So I checkout version of the file which produce the old SHA1 308806c....

[mellanox@mellanox-compile ib-tmp]$ git checkout mlx4-start -- SymmK/St.c [mellanox@mellanox-compile ib-tmp]$ git hash-object -w SymmK/St.c 308806cf3a864656a49d00edc35b9505abd627a2

than I did [mellanox@mellanox-compile ib-tmp]$ git diff-tree --stdin -p --pretty 597e70e7dc8e06a7cdbe4d9e9727411c964bd023 > commit-597e70e

( which is the commit SHA1)

[mellanox@mellanox-compile ib-tmp]$ git apply commit-597e70e Adds trailing whitespace. ../ib/commit-597e70e:1622: Adds trailing whitespace. ../ib/commit-597e70e:1646: (int)devif->lock_dma + lockid*sizeof(u64), warning: 2 lines add whitespace errors. [mellanox@mellanox-compile ib-tmp]$ git hash-object -w SymmK/St.c e69de29bb2d1d6434b8b29ae775ad8c2e48c5391

So the same commit actual lead to the wrong SHA1 (I tried this flow on different file and it works)

I think I am close but still not there , any suggestions ?

Thanks Yossi

Previous: J. Bruce FieldsNext: Linus Torvalds
Message 14 of 20 in “Re: corrupt object on git-gc”
  1. Yossi LeybovichNov 9, 2007
  2. Andreas EricssonNov 9, 2007
  3. Yossi LeybovichNov 9, 2007
  4. Johannes SixtNov 9, 2007
  5. Yossi LeybovichNov 9, 2007
  6. Johannes SixtNov 9, 2007
  7. Nicolas PitreNov 9, 2007
  8. Yossi LeybovichNov 9, 2007
  9. Nicolas PitreNov 9, 2007
  10. Linus TorvaldsNov 9, 2007
  11. add a howto document about corrupted blob recoveryNicolas Pitre, Nov 9, 2007
  12. Johannes SchindelinNov 9, 2007
  13. J. Bruce FieldsNov 26, 2007
  14. Yossi LeybovichNov 9, 2007
  15. Linus TorvaldsNov 9, 2007
  16. Yossi LeybovichNov 9, 2007
  17. Linus TorvaldsNov 9, 2007
  18. Mike HommeyNov 9, 2007
  19. Yossi LeybovichNov 9, 2007
  20. Mike HommeyNov 9, 2007

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.