Subject: Re: [PATCH] Give support for hooks based on platform

From: Junio C Hamano <[email-masked]>
Date: Mon, 23 Aug 2021 09:35:05 -0700

"brian m. carlson" <[email-masked]> writes:

> Then, in general, it can be done in a shell script containing an if-then
> statement per platform using the native tools, so I'm not seeing the
> particular reason that this series is necessary if the hooks being
> executed aren't binaries.  All systems on which Git runs must contain a
> POSIX-compatible shell.

When we start defining our hooks in the configuration, this may fit
with the conditional inclusion of configuration files.  Current
conditions only can depend on where the repository is, but it is
easy to imagine that a conditional inclusion based on the value of
the configuration variable, so

	[includeIf "var:dev.host=mac"]
		path = ...
	[includeIf "var:dev.host=win"]
		path = ...

might be a way to say "if the dev.host configuration (presumably set
in somewhere like /etc/gitconfig or ~/.gitconfig) is set to this
value, take the configuration from the specified path.

It is up to the project to define the variable they use to switch
on; some project may ship with a set of hooks that can be used on
both windows and cygwin at the same time, in which case they do not
need the distinction between the two, and some other project may
care about the distinction.  Git does not have to impose or enforce
any policy about the granularity of what "the platform" is, with
such a scheme.