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

Re: [PATCH] checkout_entry: only try to create directories when no file existed there

From
David Kastrup <dak@gnu.org>
Date
Aug 8, 2007, 21:27 UTC
Message-ID
<85y7glpvhi.fsf@lola.goethe.zz>
In-Reply-To
<Pine.LNX.4.64.0708082200240.14781@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 9 quoted lines
> It is obvious that we do not have to create directories when the file we
> want to check out already existed.
>
> Besides, it fixes the obscure use case, where you want to track a
> file which is _outside_ of your working tree, by creating a symbolic
> link to the directory it lives in, and adding the file with
> something like "git add symlink/file".  Without this patch, "git
> checkout symlink/file" would actually _replace_ "symlink" by a
> directory of the same name.

Uh, when git is tracking symlinks (and it does by default), this is quite the correct thing to do. Of course, it should rather barf with a merge conflict. But it has no business following links and doing potential damage either outside or inside of the work tree, by confusing the target of a link with the link itself. For example, I can easily relocate a complete git work tree with "mv" in the directory hierarchy. Should an update/commit/whatever then start wreaking havoc in places that incidentally don't point to the same location anymore?

My vote here is emphatically "no". Just maintain the links, not whatever they point to.

I can think of only a single reasonable exception: if the symlink itself is _not_ registered (because is has been explicitly entered into a .gitignore file or never added for other reasons), but its target _has_ been added explicitly _dereferencing_ the symlink. This difference can only occur with directory symlinks since file symlinks can't be distinguished in this manner from the name of the link itself.

It would be good if somebody brought this to Johannes' attention, even if just replying with a quotation: he chose to killfile me.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: Johannes Schindelin
Message 6 of 6 in “checkout_entry: only try to create directories when no file existed there”
  1. checkout_entry: only try to create directories when no file existed thereJohannes Schindelin, Aug 8, 2007
  2. Junio C HamanoAug 8, 2007
  3. Johannes SchindelinAug 8, 2007
  4. Junio C HamanoAug 8, 2007
  5. Johannes SchindelinAug 8, 2007
  6. David KastrupAug 8, 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.