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

Re: [RFC PATCH 0/3] submodules with no working tree shall unset core.worktree

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 13, 2018, 18:00 UTC
Message-ID
<xmqq7en27ej0.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180612235825.12271-1-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
> The first patch teaches checkout/reset (with --recurse-submodules) to unset
> the core.worktree config when the new state of the superprojects working tree
> doesn't contain the submodules working tree.
Are there two cases of "doesn't contain working tree of a submodule"?

The superproject's commit may not have a gitlink to a specific submodule in its tree (i.e. there is no way to even "submodule init" with such a commit in the superproject's history). Or there may be a gitlink but the user chose not to check it out in the working tree.

Do they need to be treated differently, or can they be treated the same way?

Also, is the "submodule" feature supposed to play well with multiple worktree feature? Let's imagine that you have two worktrees for a single superproject, and the branches of the superproject these two worktrees check out are different ones (which is the more sensible set-up than checking out the same branch twice). Further imagine that the superproject started using a single submodule sometime in the past and keeps using it throughout its life since then.

 1. if both of these two branches have the submodule, and two
    worktrees both are interested in having the submodule checked
    out via "submodule init/update", where does core.worktree point
    at?  Do we have two copies of the variable?
 2. what if one branch predates the use of the submodule in the
    superproject while the other branch is newer and uses the
    submodule?  Where does core.worktree point at?
Thanks.
Show 19 quoted lines
> The last patch is teaching "git submodule deinit" to unset the core.worktree
> setting as well. It turned out this one is tricky, as for that we also
> have to set it in the counter part, such as "submodule update".
>
> Thanks,
> Stefan
>
> Stefan Beller (3):
>   submodule: unset core.worktree if no working tree is present
>   submodule: ensure core.worktree is set after update
>   submodule deinit: unset core.worktree
>
>  builtin/submodule--helper.c | 26 ++++++++++++++++++++++++++
>  git-submodule.sh            |  5 +++++
>  submodule.c                 | 14 ++++++++++++++
>  submodule.h                 |  2 ++
>  t/lib-submodule-update.sh   |  5 +++--
>  t/t7400-submodule-basic.sh  |  5 +++++
>  6 files changed, 55 insertions(+), 2 deletions(-)
Previous: Stefan BellerNext: Stefan Beller
Message 6 of 11 in “submodules with no working tree shall unset core.worktree”
  1. 0/3 submodules with no working tree shall unset core.worktreeStefan Beller, Jun 12, 2018
  2. 1/3 submodule: unset core.worktree if no working tree is presentStefan Beller, Jun 12, 2018
  3. 2/3 submodule: ensure core.worktree is set after updateStefan Beller, Jun 12, 2018
  4. SZEDER GáborJun 16, 2018
  5. 3/3 submodule deinit: unset core.worktreeStefan Beller, Jun 12, 2018
  6. Junio C HamanoJun 13, 2018
  7. Stefan BellerJun 13, 2018
  8. 0/3 submodules with no working tree shall unset core.worktreeStefan Beller, Jun 19, 2018
  9. 1/3 submodule: unset core.worktree if no working tree is presentStefan Beller, Jun 19, 2018
  10. 2/3 submodule: ensure core.worktree is set after updateStefan Beller, Jun 19, 2018
  11. 3/3 submodule deinit: unset core.worktreeStefan Beller, Jun 19, 2018

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.