Re: [PATCH v2 2/2] worktree: add per-worktree config files
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Sep 30, 2018, 07:15 UTC
- Message-ID
- <CACsJy8AVowvXDkOh_fjdRpNtcXWchxFULbE8m9ZPQN9BsJx5ag@mail.gmail.com>
- In-Reply-To
- <CAPig+cSv4P99ZJ=CtCC7HctfSg5W6sadiknhk9yXSaBDZ81ctw@mail.gmail.com>
On Sun, Sep 30, 2018 at 6:33 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 18 quoted lines
> > diff --git a/builtin/config.c b/builtin/config.c
> > @@ -645,7 +649,20 @@ int cmd_config(int argc, const char **argv, const char *prefix)
> > + else if (use_worktree_config) {
> > + struct worktree **worktrees = get_worktrees(0);
> > + if (repository_format_worktree_config)
> > + given_config_source.file = git_pathdup("config.worktree");
> > + else if (worktrees[0] && worktrees[1])
> > + die(_("--worktree cannot be used with multiple "
> > + "working trees unless the config\n"
> > + "extension worktreeConfig is enabled. "
> > + "Please read \"CONFIGURATION FILE\"\n"
> > + "section in \"git help worktree\" for details"));
> > + else
> > + given_config_source.file = git_pathdup("config");
>
> I'm not sure I understand the purpose of allowing --worktree when only
> a single worktree is present and extensions.worktreeConfig is not set.
> Can you talk about it a bit more?Unified API. If I write a script to do stuff and want it to work in multiple worktrees as well, I should not need to do "if single worktree, use "git config --local", if multiple use "git config --worktree"". By using "git config --worktree" I tell git "this config is per-worktree" and git should do the right thing, single worktree or not.
-- Duy