Re: [PATCH v2 2/2] ls-files: fix path used when recursing into submodules
- From
- Brandon Williams <bmwill@google.com>
- Date
- Apr 13, 2017, 18:10 UTC
- Message-ID
- <20170413181031.GB96917@google.com>
- In-Reply-To
- <20170413171224.3537-2-jacob.e.keller@intel.com>
On 04/13, Jacob Keller wrote:
Show 19 quoted lines
> From: Jacob Keller <jacob.keller@gmail.com> > > Don't assume that the current working directory is the root of the > repository. Correctly generate the path for the recursing child > processes by building it from the work_tree() root instead. Otherwise if > we run ls-files using --git-dir or --work-tree it will not work > correctly as it attempts to change directory into a potentially invalid > location. Best case, it doesn't exist and we produce an error. Worst > case we cd into the wrong location and unknown behavior occurs. > > Add a new test which highlights this possibility. > > Signed-off-by: Jacob Keller <jacob.keller@gmail.com> > --- > I'm not sure that I'm convinced by this method of solving the problem as > I suspect it has some corner cases (what about when run inside a > subdirectory? It seems to work for me but I'm not sure...) Additionally, > it felt weird that there's no helper function for creating a toplevel > relative path.
I never considered the case where you use --git-dir or --work-tree, definitely an oversight on my part. This change seems reasonable to me.
-- Brandon Williams