Re: [PATCH v3 6/6] worktree add: switch to worktree version 1
From: Duy Nguyen <hidden>
Date: 2016-06-15 23:08:03
On Mon, Feb 1, 2016 at 12:33 PM, Max Kirillov [off-list ref] wrote:
On Tue, Jan 26, 2016 at 06:44:45PM +0700, Nguyễn Thái Ngọc Duy wrote:quoted
+ for (key_p = per_wortree_keys; *key_p; key_p++) { + const char *key = *key_p; + char *value = get_key(sb.buf, key); + + if (value) { + if (git_config_set(key, value)) + die(_("failed to keep %s in main worktree's config file"), key); + if (git_config_set_in_file(sb.buf, key, NULL)) + die(_("failed to delete %s in shared config file"), key); + free(value); + } + }1. For submodules (which must be left per-worktree) this approach is not going to work, because you don't know all variables in advance. You could scan the config file and match those actual keys which are there with patterns.
Hmm.. we could keep existing submodule.* per-worktree. New variables are per-worktree by default, unless you do "git config --repo" in git-submodule.sh. Am I missing something?
2. This migrates variables to the default (or current?) worktree, what about others existing?
In v0, $C/config contains all shared variables, once we move these shared vars to $C/common/config, they will be visible to all other worktrees. Or do you replicate per-worktree vars in $C/config to all worktrees ? -- Duy