Subject: Re: [PATCH v6 1/6] submodules: add helper functions to determine presence of submodules

From: Brandon Williams <[email-masked]>
Date: Fri, 2 Dec 2016 10:36:22 -0800

On 12/01, Jeff King wrote:
> On Thu, Dec 01, 2016 at 01:56:32PM -0800, Stefan Beller wrote:
> 
> > > Bleh. Looks like it happens as part of the recently-added
> > > get_common_dir(). I'm not sure if that is ever relevant for submodules,
> > > but I guess in theory you could have a submodule clone that is part of a
> > > worktree?
> > 
> > Sure we can, for a test that we don't have that, see the embedgitdirs series. ;)
> > 
> > For now each submodule has its own complete git dir, but the vision
> > would be to have a common git dir for submodules in the common
> > superprojects git dir as well, such that objects are shared actually. :)
> 
> Fair enough. Given that it seems to behave OK even in error cases, the
> simple stat() test may be the best option, then. I do think we should
> consider adding a few test cases to make sure it continues to behave in
> the error cases (just because we are relying partially on what git's
> setup code happens to do currently, and we'd want to protect ourselves
> against regressions).

For the naive (ie me), is there a reason why real_path() couldn't be
re-implemented to avoid using chdir?  I tried looking into the history of
the function but couldn't find anything explaining why it was done that
way.  I assume it has to do with symlinks, but I thought there was a
syscall (readlink?) that could do the resolution.

-- 
Brandon Williams