Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> writes: > ($C stands for $GIT_COMMON_DIR for the rest of the message) > > In main worktree, we read these config files in this order: > > 1) system config > 2) XDG config > 3) user config > 4) $GIT_DIR/config > > Currently linked worktrees share the same config file at step 4 with > main worktree. The problem is, not all config variables can be > shared. We need per-repo vars and per-worktree ones. > > With this patch, since worktree v1, the repo config file (or worktree > config file in multi worktree context) is no longer shared. Main > worktree reads $C/config. Linked worktrees read $C/worktrees/xxx/config > and a new file, $C/worktrees/config. Sharing is done via this new > file. The read hierarchy for a worktree becomes > > 1) system config > 2) XDG config > 3) user config > 4) $C/common/config > 5) $C/worktrees/xxx/config (or $C/config for main worktree) > > Compare to an alternative scheme where $C/config contains both shared > variables and main-worktree-only ones, this is a cleaner design. > > * We do not have to check every single variable name to see if it's > shared or per-worktree when reading config files. > > * We do not enforce any particular variable split. If a variable > is in $C/worktrees/config, it is shared. Putting core.worktree in > $C/worktrees/config is punished the same way the variable is put in > $HOME/.gitconfig, for example. > > * We will provide a new "git config --repo" to access this new config > file. In single-worktree context, or worktree v0, --repo is an alias > of --local. > > There is one problem though. We store worktree version in config file > and expect that all worktrees must share the same version (i.e. read > the same config file). But the share-ness of per-repo config files is > changed based on worktree version. Where do we put extensions.worktree > then? I cannot see why it cannot live in $C/common/config, which would be read as the fourth alternative in your earlier enumeration. What I am missing? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html