Re: [RFC PATCH 1/1] dir: consider worktree config in path recursion
- From
- oss dev <gg.oss.dev@gmail.com>
- Date
- May 7, 2022, 17:59 UTC
- Message-ID
- <CAAA5oLmAMu=Dj8pOgMLGCeYO2c4mrNP38bjdKEVuBkzdb1=R9g@mail.gmail.com>
- In-Reply-To
- <CABPp-BFwiLXMVaFs-Lc-zU6X=pBiF8+o9rOuHEAArD2zMQ1NNQ@mail.gmail.com>
On Fri, May 6, 2022 at 11:26 PM Elijah Newren <newren@gmail.com> wrote:
> I haven't thought it through, but is there a reason you can't just > compare the_repository->gitdir to sb.buf at this point? Why is > real_pathdup needed?
I used `real_pathdup` here because `the_repository->gitdir` is not necessarily normalized as required for the `strcmp`. For example, when using option `--git-dir=./././xyz/.git` while outside the worktree, the path will remain as is (see [1] and [2]).
[1]: https://github.com/git/git/blob/e8005e4871f130c4e402ddca2032c111252f070a/setup.c#L962 [2]: https://github.com/git/git/blob/e8005e4871f130c4e402ddca2032c111252f070a/environment.c#L353
> Thanks for finding, reporting, and sending in a patch. Could you > split up the patch as indicated above, and add a testcase to the patch > with the fix, and include your Signed-off-by trailer on the commits?
WIll do, thx.