New design. We now define multiworktree behavior with config var
extensions.worktree. Latest git must support all older behavior
versions. If config file says "version 1", even if latest version is
3, git must behave like version 1. This covers all aspects of
multi-worktree, not just config files.

With that foundation, we can now build version 1 (version 0 is what
is already released). Version 1 stores per-worktree config in
$GIT_DIR/worktrees/.../config. The list of config vars is hard coded.
New list requires new worktree version.

The hard coded list actually supports precise variable name matching,
or prefix matching (e.g. submodule.*). I don't suppose we need full
fnmatch to support submodules.

include.path is now extended a bit to give the user an opportunity to
change the config split. The user can turn a shared config into
per-worktree (but not the other way around). It's done by allowing env
expansion in include.path. So if you specify

    include.path = $GIT_DIR/abc

"abc" will always be per-worktree.

Upgrade support is manual (for now). When a new worktree is added, we
can bump from version 0 (i.e. extensions.worktree is missing) to 1.
But that's it. We can't safely bump 1 to 2 automatically.

The code in this series is not meant to be run (I didn't even test
it). It's just in case my C expresses my ideas better than my English.

Nguyễn Thái Ngọc Duy (6):
  Define new repo extension to manage multiple worktree behaviors
  config.c: move worktree-specific variables to .git/worktrees/...
  setup.c: remove special case of core.worktree and core.bare
  worktree: make core.sparseCheckout and core.ignoreStat per-worktree
  config.c: allow to un-share certain config in multi-worktree setup
  worktree: bump worktree version to 1 on "worktree add"

 Documentation/config.txt                       |   4 +
 Documentation/git-worktree.txt                 |  12 ++
 Documentation/gitrepository-layout.txt         |   5 +
 Documentation/technical/repository-version.txt |   9 ++
 builtin/config.c                               |   9 ++
 builtin/worktree.c                             |  33 ++++++
 cache.h                                        |   4 +-
 config.c                                       | 151 +++++++++++++++++++++++--
 environment.c                                  |  14 +++
 setup.c                                        |  65 +++++------
 10 files changed, 264 insertions(+), 42 deletions(-)

-- 
2.3.0.rc1.137.g477eb31

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to