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

Re: [PATCH v3] config.c: split some variables to $GIT_DIR/config.worktree

From
Duy Nguyen <pclouds@gmail.com>
Date
Apr 3, 2015, 10:30 UTC
Message-ID
<CACsJy8C=MPLyba68ttQ2hhrM7bg8E-tEG-0kUjTLnNMMbX0MUQ@mail.gmail.com>
In-Reply-To
<20150401205644.GA3656@wheezy.local>
On Thu, Apr 2, 2015 at 3:56 AM, Max Kirillov <max@max630.net> wrote:
Show 13 quoted lines
> On Tue, Mar 31, 2015 at 07:14:39PM +0700, Nguyễn Thái Ngọc Duy wrote:
>>  The general principle is like in the last mail: .git/config is for
>>  both shared and private keys of main worktree (i.e. nothing is
>>  changed from today).  .git/worktrees/xx/config.worktree is for
>>  private keys only (and private keys in .git/config are ignored)
>>
>>  With this we don't have to bump core.repository_format_version for
>>  main worktree because nothing is changed. There will be problems
>>  with info/config.worktree:
>>
>>   - it's customizable, so expect the user to break it (*)
>
> I would rather say it's manual tuning rather than a break.
But if the user accidentally deletes core.worktree then something will break.
Show 14 quoted lines
>>   - if we add new stuff to the template, we'll need to help migrate
>>     current info/core.worktree (which does not have new stuff).
>>     Auto updating this file could be risky. I'm tend to just
>>     warn the user that this and that keys should be included and let
>>     them modify the file.
>
> I don't think there even should be warning. Just don't
> change the info/config.worktree in the existing repositories
> and let users extend it as they feel a need for it.
>
> Later there could be a tool (an option to git config for
> example) which adds a variable or pattern to the
> info/core.worktree and copied existing variable(s) from
> commong config to worktree-specific ones.

I was thinking "git checkout --to" would do this. It checks if the main worktree has info/core.worktree, if not, re-init the repo to add this file from default template.

Show 17 quoted lines
>> @@ -1932,6 +2002,23 @@ int git_config_set_multivar_in_file(const char *config_filename,
>>
>>       store.multi_replace = multi_replace;
>>
>> +     if (git_common_dir_env && is_config_local(key)) {
>> +             if (!config_filename)
>> +                     config_filename = filename_buf = git_pathdup("config.worktree");
>> +             /* cheap trick, but should work 90% of time */
>> +             else if (!ends_with(config_filename, ".worktree"))
>> +                     die("%s can only be stored in %s",
>> +                         key, git_path("config.worktree"));
>
> Is `config_filename` set only for cases when config file is
> explicitly set for "git config" command with "--file"
> option? Then probably here should not be any intelligence at
> all; if user resort to manual picking the file he must be
> allowed to do stupid things.

Yes. It may make sense in the previous versions where this feature could work in a normal worktree, but when it becomes multiworktree-specific, I guess we can drop this.

-- 
Duy
Previous: Max KirillovNext: Max Kirillov
Message 17 of 22 in “worktree.* config keys and submodule and multiple worktrees”
  1. 0/3 worktree.* config keys and submodule and multiple worktreesNguyễn Thái Ngọc Duy, Feb 8, 2015
  2. 1/3 config.c: new config namespace worktree.* stored in $GIT_DIR/config.worktreeNguyễn Thái Ngọc Duy, Feb 8, 2015
  3. 2/3 setup: add worktree.path to shadow core.worktreeNguyễn Thái Ngọc Duy, Feb 8, 2015
  4. 3/3 submodule: use worktree.path instead of core.worktreeNguyễn Thái Ngọc Duy, Feb 8, 2015
  5. Jens LehmannFeb 8, 2015
  6. Jens LehmannFeb 8, 2015
  7. Duy NguyenFeb 9, 2015
  8. per-repository and per-worktree config variablesMax Kirillov, Mar 18, 2015
  9. Duy NguyenMar 24, 2015
  10. config.c: split some variables to $GIT_DIR/config.worktreeNguyễn Thái Ngọc Duy, Mar 26, 2015
  11. Max KirillovMar 26, 2015
  12. Duy NguyenMar 29, 2015
  13. Max KirillovMar 30, 2015
  14. config.c: split some variables to $GIT_DIR/config.worktreeNguyễn Thái Ngọc Duy, Mar 31, 2015
  15. Duy NguyenMar 31, 2015
  16. Max KirillovApr 1, 2015
  17. Duy NguyenApr 3, 2015
  18. Max KirillovApr 13, 2015
  19. Duy NguyenApr 18, 2015
  20. Max KirillovApr 20, 2015
  21. Duy NguyenApr 20, 2015
  22. Jens LehmannMar 25, 2015

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.