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

Re: [PATCH/RFC v2] Squashed changes for multiple worktrees vs. submodules

From
Duy Nguyen <pclouds@gmail.com>
Date
Dec 5, 2014, 01:33 UTC
Message-ID
<CACsJy8BWv8U6+sujEj8HgMGmgFJR_YgCroYHcG1jsoGtbVCD7Q@mail.gmail.com>
In-Reply-To
<5480BEB9.8070109@web.de>
On Fri, Dec 5, 2014 at 3:06 AM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
> Wow, so the .git/config is shared between all worktrees? I
> suspect you have very good reasons for that,

most of config vars are at repo-level, not worktree-level, except maybe submodule.* and something else. Technically we could use "include.path" to point to a non-shared file, where we store worktree-specific config.

Show 16 quoted lines
> but I believe
> that'll make multiple work trees surprise the user from time
> to time when used with submodules. Because initializing a
> submodule in one worktree initializes it in all other
> worktrees too (I suspect other users regard "git submodule
> init" being a worktree local command too). And setting
> "submodule.<name>.update" to "none" will also affect all
> other worktrees. But I'd need to have separate settings for
> our CI server, e.g. to checkout the sources without the
> largish documentation submodule in one test job (=worktree)
> while checking out the whole documentation for another job
> building the setup in another worktree.
>
> And if I understand the "checkout: reject if the branch is
> already checked out elsewhere" thread correctly, I won't be
> able to build "master" in two jobs at the same time?

If you do "git checkout --to ... master^{}", it should run fine. I'm still considering doing something better with the read-only refs, but haven't found time to really think it through yet.

Show 15 quoted lines
> Thanks. But I changed my mind about the details (now that I
> know about .git/config and multiple worktrees). I think you'd
> have to connect a .git directory in the submodule to the
> common git dir directly, as you cannot use the core.worktree
> setting (which could be different between commits due to
> renames) when putting it into <worktree>/.git/modules. And
> then you couldn't remove or rename a submodule anymore,
> because that fails when it contains a .git directory.
>
> Seems like we should put a "Warning: may do unexpected things
> when used with submodules" (with some examples about what might
> happen) in the multiple worktrees documentation. And I don't
> believe anymore that teaching submodules to use the common git
> dir makes that much sense after I know about the restrictions
> it imposes.
I'm ok with such a warning fwiw.
-- 
Duy
Previous: Jens LehmannNext: Jens Lehmann
Message 7 of 14 in “Squashed changes for multiple worktrees vs. submodules”
  1. Squashed changes for multiple worktrees vs. submodulesMax Kirillov, Nov 30, 2014
  2. Duy NguyenDec 1, 2014
  3. Max KirillovDec 1, 2014
  4. Jens LehmannDec 2, 2014
  5. Max KirillovDec 2, 2014
  6. Jens LehmannDec 4, 2014
  7. Duy NguyenDec 5, 2014
  8. Jens LehmannDec 6, 2014
  9. Max KirillovDec 5, 2014
  10. Jens LehmannDec 6, 2014
  11. Max KirillovDec 7, 2014
  12. Max KirillovDec 7, 2014
  13. Jens LehmannDec 8, 2014
  14. Max KirillovDec 8, 2014

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.