Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:20

Jeff King [off-list ref] writes:
On Tue, Sep 09, 2008 at 12:31:39PM +0200, Johannes Sixt wrote:
quoted
Junio C Hamano schrieb:
quoted
+/*
+ * 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).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help