git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Sep 30, 2018, 07:24 UTC
Message-ID
<CAPig+cTJKuEkb5AVi=xyztfEo84NzaduNnX3mhec3xrYf4PGUg@mail.gmail.com>
In-Reply-To
<CACsJy8AVowvXDkOh_fjdRpNtcXWchxFULbE8m9ZPQN9BsJx5ag@mail.gmail.com>
On Sun, Sep 30, 2018 at 3:16 AM Duy Nguyen <pclouds@gmail.com> wrote:
Show 26 quoted lines
> On Sun, Sep 30, 2018 at 6:33 AM Eric Sunshine <sunshine@sunshineco.com> 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.

Previous: Duy NguyenNext: Duy Nguyen
Message 23 of 34 in “worktree: add per-worktree config files”
  1. worktree: add per-worktree config filesNguyễn Thái Ngọc Duy, Sep 23, 2018
  2. Eric SunshineSep 23, 2018
  3. Taylor BlauSep 24, 2018
  4. Duy NguyenSep 25, 2018
  5. Duy NguyenSep 29, 2018
  6. Junio C HamanoSep 25, 2018
  7. Duy NguyenSep 26, 2018
  8. Junio C HamanoSep 26, 2018
  9. Wherefor worktrees?Marc Branchaud, Sep 27, 2018
  10. Duy NguyenSep 27, 2018
  11. Ævar Arnfjörð BjarmasonSep 26, 2018
  12. Duy NguyenSep 27, 2018
  13. Ævar Arnfjörð BjarmasonSep 27, 2018
  14. Duy NguyenSep 27, 2018
  15. Duy NguyenSep 29, 2018
  16. 0/2 Per-worktree config filesNguyễn Thái Ngọc Duy, Sep 29, 2018
  17. 1/2 t1300: extract and use test_cmp_config()Nguyễn Thái Ngọc Duy, Sep 29, 2018
  18. Eric SunshineSep 30, 2018
  19. SZEDER GáborSep 30, 2018
  20. 2/2 worktree: add per-worktree config filesNguyễn Thái Ngọc Duy, Sep 29, 2018
  21. Eric SunshineSep 30, 2018
  22. Duy NguyenSep 30, 2018
  23. Eric SunshineSep 30, 2018
  24. Duy NguyenSep 30, 2018
  25. 0/2 Per-worktree config filesNguyễn Thái Ngọc Duy, Oct 2, 2018
  26. 1/2 t1300: extract and use test_cmp_config()Nguyễn Thái Ngọc Duy, Oct 2, 2018
  27. Eric SunshineOct 3, 2018
  28. 2/2 worktree: add per-worktree config filesNguyễn Thái Ngọc Duy, Oct 2, 2018
  29. 0/2 Per-worktree config filesNguyễn Thái Ngọc Duy, Oct 21, 2018
  30. 1/2 t1300: extract and use test_cmp_config()Nguyễn Thái Ngọc Duy, Oct 21, 2018
  31. 2/2 worktree: add per-worktree config filesNguyễn Thái Ngọc Duy, Oct 21, 2018
  32. Junio C HamanoOct 22, 2018
  33. Duy NguyenOct 22, 2018
  34. Junio C HamanoOct 25, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.