Re: [PATCH] worktree: add per-worktree config files
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 25, 2018, 21:26 UTC
- Message-ID
- <xmqqtvmdnuab.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180923170438.23610-1-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> This extension is most useful in multiple worktree setup because you > now have an option to store per-worktree config (which is either > .git/config.worktree for main worktree, or > .git/worktrees/xx/config.worktree for linked ones).
Heh. "This is useful if you have multiple" is true without saying, because this is totally useless if you have only a single worktree. I'd suggest writing the above without "most useful".
> This design places a bet on the assumption that the majority of config > variables are shared so it is the default mode. A safer move would be > default writes go to per-worktree file, so that accidental changes are > isolated.
Warning: devil's advocate mode on.
Done in either way, this will confuse the users. What is the reason why people are led to think it is a good idea to use multiple worktrees, even when they need different settings? What do they want out of "multiple worktrees linked to a single repository" as opposed to just a simple "as many clones as necessary"? Reduced disk footprint? Is there a better way to achieve that without the downside of multiple worktrees (e.g. configuration need to be uniform)?
> (*) "git config --worktree" points back to "config" file when this > extension is not present so that it works in any setup.
Shouldn't it barf and error out instead? A user who hasn't enabled the extension uses --worktree option and misled to believe that the setting affects only a single worktree, even though the change is made globally---that does not sound like a great end-user experience.