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

Re: [PATCH v3] Add an option not to use link(src, dest) && unlink(src) when that is unreliable

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Apr 27, 2009, 15:15 UTC
Message-ID
<alpine.LFD.2.00.0904270806130.22156@localhost.localdomain>
In-Reply-To
<alpine.DEB.1.00.0904271400180.10279@pacific.mpi-cbg.de>
On Mon, 27 Apr 2009, Johannes Schindelin wrote:
Show 5 quoted lines
> 
> So, force the use of rename() instead of the link() && unlink()
> incantation on Windows, and for good measure, add a
> core.unreliableHardlinks option to optionally force it on other
> platforms, too.
Ok, so:
	Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
but I do think it could be improved. See below..
> 	Junio, do you want me to remove the config variable?

I'd keep it. But I'd suggest that the naming is odd. Why talk about "unreliable hardlinks", when that's just a particular symptom. Why not just talk about whether hardlinks should be used or not?

And to avoid double negative, make it
	[core]
		usehardlinks = true/false
and then default it to 'true' for Unix.

The thing is, maybe people would prefer to use 'rename' over the link/unlink games even on some unixes, and not because of 'reliability' issues, but because they may have some filesystems that don't do hardlinks, and they'd just rather speed things up by avoiding the 'link()' system call that will just error out.

So naming matters. Calling it 'unreliablehardlinks' in that case would be odd. They're not unreliable - you just don't want to try to use them.

I also do wonder if we could/should make this one of those options that get set automatically at 'git init' time, rather than silently hardcoded as a compile option. I thought hardlinks at least sometimes worked fine on Windows too, don't they?

I do detest _hidden_ default values for config options, unless those hidden defaults are "obviously always correct" as a default. This one smells a bit uncertain, and as a result I think it's ok to default to not using hardlinks, but doing it with .gitconfig would be nicer.

Hmm?
		Linus
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 22 of 38 in “Add an option not to use link(src, dest) && unlink(src) when that is unreliable”
  1. Add an option not to use link(src, dest) && unlink(src) when that is unreliableJohannes Schindelin, Apr 23, 2009
  2. Johannes SixtApr 23, 2009
  3. Johannes SchindelinApr 23, 2009
  4. Add an option not to use link(src, dest) && unlink(src) when that is unreliableJohannes Schindelin, Apr 25, 2009
  5. Junio C HamanoApr 25, 2009
  6. Linus TorvaldsApr 25, 2009
  7. Michael GaberApr 25, 2009
  8. Linus TorvaldsApr 25, 2009
  9. Jay SoffianApr 27, 2009
  10. Johannes SixtApr 25, 2009
  11. Junio C HamanoApr 25, 2009
  12. Johannes SchindelinApr 26, 2009
  13. Linus TorvaldsApr 25, 2009
  14. Alex RiesenApr 23, 2009
  15. Johannes SchindelinApr 23, 2009
  16. Alex RiesenApr 24, 2009
  17. Linus TorvaldsApr 25, 2009
  18. Johannes SixtApr 25, 2009
  19. Junio C HamanoApr 26, 2009
  20. Johannes SchindelinApr 26, 2009
  21. Add an option not to use link(src, dest) && unlink(src) when that is unreliableJohannes Schindelin, Apr 27, 2009
  22. Linus TorvaldsApr 27, 2009
  23. Johannes SchindelinApr 27, 2009
  24. Linus TorvaldsApr 27, 2009
  25. Junio C HamanoApr 27, 2009
  26. Linus TorvaldsApr 27, 2009
  27. Linus TorvaldsApr 27, 2009
  28. Junio C HamanoApr 27, 2009
  29. Johannes SchindelinApr 27, 2009
  30. Linus TorvaldsApr 27, 2009
  31. Rename core.unreliableHardlinks to core.createObjectJohannes Schindelin, Apr 27, 2009
  32. Junio C HamanoApr 27, 2009
  33. Johannes SchindelinApr 28, 2009
  34. Junio C HamanoApr 28, 2009
  35. Johannes SchindelinApr 28, 2009
  36. Junio C HamanoApr 28, 2009
  37. Johannes SchindelinApr 28, 2009
  38. Johannes SchindelinApr 26, 2009

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.