Subject: Re: [PATCH] config: introduce an Operating System-specific `includeIf` condition

From: Junio C Hamano <[email-masked]>
Date: Tue, 22 Nov 2022 09:03:03 +0900

"Johannes Schindelin via GitGitGadget" <[email-masked]>
writes:

> From: Johannes Schindelin <[email-masked]>
>
> It is relatively common for users to maintain identical `~/.gitconfig`
> files across all of their setups, using the `includeIf` construct
> liberally to adjust the settings to the respective setup as needed.
>
> In case of Operating System-specific adjustments, Git currently offers
> no support to the users and they typically use a work-around like this:
>
> 	[includeIf "gitdir:/home/"]
> 		path = ~/.gitconfig-linux
> 	[includeIf "gitdir:/Users/"]
> 		path = ~/.gitconfig-mac
> 	[includeIf "gitdir:C:"]
> 		path = ~/.gitconfig-windows
>
> However, this is fragile, as it would not even allow to discern between
> Operating Systems that happen to host their home directories in
> `/home/`, such as Linux and the BSDs.
>
> Let's introduce a new condition: `os:<uname-s>` where `<uname-s>` is the
> system name, i.e. the output of `uname -s`.

As I am not confident enough that we made the best choice that would
last forever with the initial attempt when we picked "uname -s" as
the way to switch on "OS", I wouldn't call it "OS".  Perhaps

	[includeIf "uname-s:Linux"] path = ...

would be what I would pick.  Other than that, the feature makes
quite a lot of sense.