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

Re: My git repo is broken, how to fix it ?

From
Alex Riesen <raa.lkml@gmail.com>
Date
Feb 28, 2007, 19:12 UTC
Message-ID
<81b0412b0702281112y714c3b0eread09ee9440d0537@mail.gmail.com>
In-Reply-To
<Pine.LNX.4.64.0702280802150.12485@woody.linux-foundation.org>
On 2/28/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:
Show 5 quoted lines
>  - try to figure out why things got corrupted in the first place.
> ...
>    But I would not be shocked to hear that the "link + unlink" sequence
>    ends up being emulated under cygwin as a "copy + delete" due to lack of
>    hardlinks or something.

Well, cygwin has a whole rename implementation using wincalls (which may or maybe not syscalls). It's hard to tell whether micros$#%^ used link+unlink: windows traditionally had no link(2). It has it since W2K, allowed only on ntfs, and even there it spent some time undocumented :)

Show 8 quoted lines
>    Also, even if the link fails, and git then falls back to "rename()"
>    (since some filesystems don't do hardlinks at all, or limit them to one
>    particular directory), I would _still_ not be totally surprised if the
>    rename got emulated as a copy/delete for some strange Windows reason.
>
>    There are other possibilities for corruption, of course: just plain
>    disk corruption, or (again) some other subtle cygwin emulation or
>    Windows issue could bite us.

It is very hard to tell: the rename function in cygwin is over 200 lines long, has multiple calls down to the kernel (or whatever it is), and there are two different wincalls used. It is hard to predict what path will be taken or whether there were actually any data copying happened. Of course, windows known to corrupt data just so...

Show 6 quoted lines
>  - It would probably be good to write up the "How to recover" thing,
>    regardless of why any corruption happens. It doesn't matter if you're
>    under UNIX and using native protocols, and just being careful as hell:
>    disks get corrupted, sh*t happens, alpha-particles in the wrong place
>    do bad things to memory cells. And bugs _are_ inevitable, even if
>    we've been pretty damn good about these things.

It'd be a good start to link the recent disaster recoveries from git.or.cz wiki from the title page (unless it is already).

Previous: Linus TorvaldsNext: Alexander Litvinov
Message 5 of 28 in “My git repo is broken, how to fix it ?”
  1. Alexander LitvinovFeb 28, 2007
  2. Linus TorvaldsFeb 28, 2007
  3. Alexander LitvinovFeb 28, 2007
  4. Linus TorvaldsFeb 28, 2007
  5. Alex RiesenFeb 28, 2007
  6. Alexander LitvinovMar 19, 2007
  7. Linus TorvaldsMar 19, 2007
  8. Linus TorvaldsMar 20, 2007
  9. Alexander LitvinovMar 20, 2007
  10. Junio C HamanoMar 20, 2007
  11. Nicolas PitreMar 20, 2007
  12. Linus TorvaldsMar 22, 2007
  13. Nicolas PitreMar 22, 2007
  14. Linus TorvaldsMar 22, 2007
  15. Linus TorvaldsMar 22, 2007
  16. Linus TorvaldsMar 22, 2007
  17. Nicolas PitreMar 22, 2007
  18. Linus TorvaldsMar 22, 2007
  19. Nicolas PitreMar 22, 2007
  20. Jeff KingMar 22, 2007
  21. Linus TorvaldsMar 23, 2007
  22. Bill LearMar 23, 2007
  23. Jeff KingMar 23, 2007
  24. git-apply: Do not free the wrong buffer when we convert the data for writeoutJunio C Hamano, Mar 22, 2007
  25. Linus TorvaldsMar 22, 2007
  26. Alexander LitvinovMar 23, 2007
  27. Alexander LitvinovMar 23, 2007
  28. Johannes SixtMar 22, 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.