git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/2] dir: consider worktree config in path recursion

From
Junio C Hamano <gitster@pobox.com>
Date
May 24, 2022, 19:45 UTC
Message-ID
<xmqqilpuhfz2.fsf@gitster.g>
In-Reply-To
<CABPp-BGXRzYCvyM38dEUvQ125+VtRu++7L9UiRz98u+1=Lov7A@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 25 quoted lines
> On Wed, May 11, 2022 at 9:37 AM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Goss Geppert <gg.oss.dev@gmail.com> writes:
>>
>> > diff --git a/dir.c b/dir.c
>> > index f2b0f24210..a1886e61a3 100644
>> > --- a/dir.c
>> > +++ b/dir.c
>> > @@ -1893,9 +1893,31 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
>>
> [...]
>>
>> > +                     real_gitdir = real_pathdup(the_repository->gitdir, 0);
>>
>> This function is repeatedly called during the traversal.
>>
>> How expensive is it to keep calling real_pathdup() on the constant
>> the_repository->gitdir just in case it might be the same as our true
>> GIT_DIR?
>
> I agree that treat_directory is called many times, but this
> real_pathdup() call is inside the "if (nested_repo)" block, so this
> new real_pathdup() invocation should occur very seldom.  Or are you
> worried about cases where users have *very* large numbers of bare
> repositories nested under the working directory?

No. I wasn't worried about anything in particular. I just wanted to get the feel of how deep a thought the patch was backed by by spot checking what was and what was not taken into account when designing the change.

I do not care too much when there are very large numbers of things that cause this codepath to be exercised. Strange situations can be left for later optimization only when they turn up in the real world and prove to be a problem.

By the way, where is a bare repository involved? did you mean non-bare aka worktree-full repository?

Previous: Elijah NewrenNext: Elijah Newren
Message 12 of 31 in “dir: consider worktree config in path recursion”
  1. 0/1 dir: consider worktree config in path recursionGoss Geppert, May 5, 2022
  2. 1/1 dir: consider worktree config in path recursionGoss Geppert, May 5, 2022
  3. Elijah NewrenMay 7, 2022
  4. oss devMay 7, 2022
  5. Junio C HamanoMay 6, 2022
  6. oss devMay 6, 2022
  7. 0/2 dir: consider worktree config in path recursionGoss Geppert, May 10, 2022
  8. 1/2 dir: consider worktree config in path recursionGoss Geppert, May 10, 2022
  9. Junio C HamanoMay 11, 2022
  10. oss devMay 20, 2022
  11. Elijah NewrenMay 24, 2022
  12. Junio C HamanoMay 24, 2022
  13. Elijah NewrenMay 25, 2022
  14. Junio C HamanoMay 11, 2022
  15. oss devMay 20, 2022
  16. Derrick StoleeMay 23, 2022
  17. oss devMay 30, 2022
  18. 2/2 dir: minor refactoring / clean-upGoss Geppert, May 10, 2022
  19. Junio C HamanoMay 11, 2022
  20. oss devMay 20, 2022
  21. 0/3 dir: traverse into repositoryGoss Geppert, May 20, 2022
  22. 1/3 dir: traverse into repositoryGoss Geppert, May 20, 2022
  23. 3/3 dir: minor refactoring / clean-upGoss Geppert, May 20, 2022
  24. 2/3 dir: cache git_dir's realpathGoss Geppert, May 20, 2022
  25. Elijah NewrenMay 24, 2022
  26. 0/2 dir: traverse into repositoryGoss Geppert, Jun 16, 2022
  27. Elijah NewrenJun 22, 2022
  28. 0/2 dir: traverse into repository (resending)Goss Geppert, Jun 16, 2022
  29. 1/2 dir: traverse into repositoryGoss Geppert, Jun 16, 2022
  30. 1/2 dir: traverse into repositoryGoss Geppert, Jun 16, 2022
  31. 2/2 dir: minor refactoring / clean-upGoss Geppert, Jun 16, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.