On Fri, May 6, 2022 at 11:26 PM Elijah Newren <newren@xxxxxxxxx> 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.