On Thu, Oct 22, 2015 at 11:23:54AM -0700, Junio C Hamano wrote:
> David Aguilar <dav...@gmail.com> writes:
> 
> > difftool's dir-diff feature was blindly feeding worktree paths
> > to hash-object without checking whether the path was indeed a
> > file, causing the feature to fail when repositories contain
> > symlinks to directories.
> 
> Wait.  Anything that considers symlinks "to directories" any special
> smells like a misdesign here.  Why is it safe to substitute a
> symbolic link that happens to point at a file with the file it
> points at?
> 
> Because the way you would hash a symblic link is not by hashing the
> file it points at, but by hashing the result of readlink(2) of it,
> we must not reuse the working tree files for any symbolic link,
> regardless of its target, I would think.
> 
> After all, a symbolic link may even be dangling and not pointing at
> anything.

Ah, right.  I think the simplest thing to do is to tighten
use_wt_file() so that it always rejects symlinks.  That seems
like a safe way to go for now without needing to invent a new
paradigm for how to handle symlinks in the dir-diff code.

I just sent a follow-up patch that does just that.  Let me know
if you'd like a replacement patch that combines the two patches
instead.

Thanks for the review,
-- 
David
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to