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

Re: Careful object writing..

From
Linus Torvalds <torvalds@osdl.org>
Date
May 3, 2005, 22:13 UTC
Message-ID
<Pine.LNX.4.58.0505031507460.26698@ppc970.osdl.org>
In-Reply-To
<20050503205957.GA25253@delft.aura.cs.cmu.edu>
On Tue, 3 May 2005, Jan Harkes wrote:
Show 6 quoted lines
> 
> Short summary:
> 
>     rc = link(old, new);
>     if (rc == -1 && errno == EXDEV)
> 	rc = rename(old, new);
Ok, that is safe enough. Will do.
> On Coda, the cross-directory link fails, the following cross-directory
> rename will work fine.  On a normal filesystem, if the link fails with
> EXDEV, the rename will fail with the same.

Yup. I do suspect that since you handle the rename anyway, you probably could handle the git link/unlink patterns too, but it's easy enough to just do the rename fallback in git itself.

The only reason not to use rename in the first place is literally just to be able to check for collisions. Which we don't actually _do_ right now, but I like to be able to do so in theory.

		Linus
Previous: Jan HarkesNext: Linus Torvalds
Message 10 of 19 in “Careful object writing..”
  1. Linus TorvaldsMay 3, 2005
  2. Chris WedgwoodMay 3, 2005
  3. Linus TorvaldsMay 3, 2005
  4. Chris WedgwoodMay 3, 2005
  5. Linus TorvaldsMay 3, 2005
  6. Daniel BarkalowMay 3, 2005
  7. Jan HarkesMay 3, 2005
  8. Linus TorvaldsMay 3, 2005
  9. Jan HarkesMay 3, 2005
  10. Linus TorvaldsMay 3, 2005
  11. Linus TorvaldsMay 3, 2005
  12. H. Peter AnvinMay 3, 2005
  13. Alex RiesenMay 3, 2005
  14. Linus TorvaldsMay 3, 2005
  15. Alex RiesenMay 3, 2005
  16. Junio C HamanoMay 3, 2005
  17. Careful object pullingDaniel Barkalow, May 4, 2005
  18. Morten WelinderMay 4, 2005
  19. Daniel BarkalowMay 4, 2005

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.