Re: [PATCH v2 2/2] worktree: add per-worktree config files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 30, 2018 at 9:24 AM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>
> On Sun, Sep 30, 2018 at 3:16 AM Duy Nguyen <pclouds@xxxxxxxxx> wrote:
> > On Sun, Sep 30, 2018 at 6:33 AM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> > > > 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.
>
> That's what I thought, but I still don't understand how that unified
> API is going to help if the script writer happens to have multiple
> worktrees but doesn't have extensions.worktreeConfig set, in which
> case the command will error out. I don't see how that simplifies
> things, but perhaps I'm missing something obvious.

No it does not simplify that step. The user has to enable it manually
(at least for now). v1 tried to enable it automatically, but I think
it's safer to go one step at a time.
-- 
Duy



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux