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

Re: [PATCH] Make Git accept absolute path names for files within the work tree

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Dec 4, 2007, 22:52 UTC
Message-ID
<alpine.LFD.0.9999.0712041444090.13796@woody.linux-foundation.org>
In-Reply-To
<20071204220840.GA3340@coredump.intra.peff.net>
On Tue, 4 Dec 2007, Jeff King wrote:
> 
> It is more expensive, though we will be doing it once per user-supplied
> pathspec, so I don't know that it will actually have an impact.
Well, I'm more worried about just bugs, actually.

Doing this right is actually rather hard. For example, our current "make_absolute_path()" is simply not very good, and it's almost impossible to *make* it very good.

Why? It relies on being able to get the current cwd, which isn't always even possible on all systems. What about unreadable directories? What about just so *deep* directories, that the cwd doesn't fit in the 1kB allocated for it? Both do happen (people use executable but non-readable directories for security sometimes). I'm also almost certain that you can confuse it by renaming directories while that thing is running, etc etc.

IOW, that whole thing is simply a bug waiting to happen. The fact that it apparently *always* runs whether needed or not just seems to make it worse (ie if we already know our cwd, and the absolute path we have already has that as a prefix, just strip it off, don't try to do anything complex, and leave the complex and fragile cases for the odd-ball when the simple approach doesn't work)

			Linus
Previous: Jeff KingNext: Jeff King
Message 20 of 21 in “Incorrect git-blame result if I use full path to file”
  1. Anatol PomozovDec 3, 2007
  2. Junio C HamanoDec 3, 2007
  3. Jeff KingDec 3, 2007
  4. Linus TorvaldsDec 3, 2007
  5. Johannes SchindelinDec 3, 2007
  6. Linus TorvaldsDec 3, 2007
  7. Linus TorvaldsDec 3, 2007
  8. Jeff KingDec 3, 2007
  9. Junio C HamanoDec 3, 2007
  10. Jeff KingDec 3, 2007
  11. Robin RosenbergDec 3, 2007
  12. Make Git accept absolute path names for files within the work treeRobin Rosenberg, Dec 3, 2007
  13. Junio C HamanoDec 3, 2007
  14. Jeff KingDec 4, 2007
  15. Johannes SchindelinDec 4, 2007
  16. Robin RosenbergDec 4, 2007
  17. Johannes SchindelinDec 4, 2007
  18. Linus TorvaldsDec 4, 2007
  19. Jeff KingDec 4, 2007
  20. Linus TorvaldsDec 4, 2007
  21. Jeff KingDec 6, 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.