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

Re: [PATCHv5 0/5] submodule embedgitdirs

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 7, 2016, 23:34 UTC
Message-ID
<xmqqeg1juxd7.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqzik7v04b.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 34 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> v5:
>> * Add another layer of abstraction, i.e. the relocate_git_dir is only about 
>>   moving a git dir of one repository. The submodule specific stuff (e.g.
>>   recursion into nested submodules) is in submodule.{c,h}
>>   
>>   This was motivated by reviews on the series of checkout aware of submodules
>>   building on top of this series, as we want to directly call the embed-git-dirs
>>   function without the overhead of spawning a child process.
>
> OK.  Comparing the last steps between this round and the previous
> one, I do think the separation of the responsibility among helpers
> is much more reasonable in this version, where:
>
>  - submodule_embed_git_dir() is given a single path and is
>    responsible for that submodule itself, which is done by calling
>    submodule_embed_git_dir_for_path() on itself, and its
>    sub-submodules, which is done by spawning the helper recursively
>    with appropriate super-prefix;
>
>  - submodule_embed_git_dir_for_path() computes where the given path
>    needs to be moved to using the knowledge specific to the
>    submodule subsystem, and asks relocate_gitdir() to perform the
>    actual relocation;
>
>  - relocate_gitdir() used to do quite a lot more, but now it is only
>    about moving an existing .git directory elsewhere and pointing to
>    the new location with .git file placed in the old location.
>
> I would have called the second helper submodule_embed_one_git_dir(),
> but that is a minor detail.
>
> Very nicely done.

One thing that is not so nice from the code organization point of view is that "dir.c" now needs to include "submodule.h" because it wants to call connect_work_tree_and_git_dir().

I wonder if that function belongs to dir.c or worktree.c not submodule.c; I do not see anything that is submodule specific about what the function does.

Previous: Junio C HamanoNext: Stefan Beller
Message 15 of 16 in “[PATCHv5 0/5] submodule embedgitdirs”
  1. Stefan BellerDec 7, 2016
  2. 2/5 submodule helper: support super prefixStefan Beller, Dec 7, 2016
  3. 3/5 test-lib-functions.sh: teach test_commit -C <dir>Stefan Beller, Dec 7, 2016
  4. 4/5 worktree: get worktrees from submodulesStefan Beller, Dec 7, 2016
  5. Junio C HamanoDec 7, 2016
  6. Stefan BellerDec 7, 2016
  7. Brandon WilliamsDec 8, 2016
  8. 5/5 submodule: add embed-git-dir functionStefan Beller, Dec 7, 2016
  9. Junio C HamanoDec 7, 2016
  10. Stefan BellerDec 7, 2016
  11. Brandon WilliamsDec 8, 2016
  12. Duy NguyenDec 8, 2016
  13. 1/5 submodule: use absolute path for computing relative path connectingStefan Beller, Dec 7, 2016
  14. Junio C HamanoDec 7, 2016
  15. Junio C HamanoDec 7, 2016
  16. Stefan BellerDec 7, 2016

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.