Subject: Re: [PATCH v3 6/6] worktree add: switch to worktree version 1

From: Max Kirillov <[email-masked]>
Date: Mon, 1 Feb 2016 07:33:33 +0200

On Tue, Jan 26, 2016 at 06:44:45PM +0700, Nguyễn Thái Ngọc Duy wrote:
> +		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.

2. This migrates variables to the default (or current?)
worktree, what about others existing?

-- 
Max