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

Re: [PATCH 1/4] is_directory(): a generic helper function

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 9, 2008, 14:51 UTC
Message-ID
<7vprnd8jad.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080909123207.GA25799@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 12 quoted lines
> On Tue, Sep 09, 2008 at 12:31:39PM +0200, Johannes Sixt wrote:
>
>> Junio C Hamano schrieb:
>> > +/*
>> > + * Do not use this for inspecting *tracked* content.  When path is a
>> > + * symlink to a directory, we do not want to say it is a directory.
>> 
>> I though stat(2) checks the thing that a symlink points to. Then either
>> this comment is not correct or you want to use lstat(2), no?
>
> I assume he meant "do not use this for tracked content, because in that
> case...". But I had to read it twice to make sense.

Sorry, I can't type, but you assumed correctly. When we are tracking a path "a/b" where "b" is a submodule, we want to notice the change made by the user to rmdir "a/b" and replace it with a symbolic link that points elsewhere, so we shouldn't be using is_directory() in such a codepath. Worse yet, we also want to catch the case where you "rm -fr a" and make a symlink that points at a directory that may (or may not) have a subdirectory "b". If we were tracking "a/b", then we have to say that the directory "a/b" does not exist anymore. It shows that is_directory() is a wrong function to use while inspecting the tracked content (aka worktree).

Previous: Jeff King
Message 12 of 12 in “Pushing into a repository with alternates”
  1. 0/4 Pushing into a repository with alternatesJunio C Hamano, Sep 9, 2008
  2. 1/4 is_directory(): a generic helper functionJunio C Hamano, Sep 9, 2008
  3. 2/4 receive-pack: make it a builtinJunio C Hamano, Sep 9, 2008
  4. 3/4 push: prepare sender to receive extended ref information from the receiverJunio C Hamano, Sep 9, 2008
  5. 4/4 push: receiver end advertises refs from alternate repositoriesJunio C Hamano, Sep 9, 2008
  6. Jeff KingSep 9, 2008
  7. Paolo BonziniSep 9, 2008
  8. Junio C HamanoSep 9, 2008
  9. Paolo BonziniSep 9, 2008
  10. Johannes SixtSep 9, 2008
  11. Jeff KingSep 9, 2008
  12. Junio C HamanoSep 9, 2008

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.