Thread (8 messages) 8 messages, 4 authors, 2024-03-20

Re: [PATCH v3 0/2] Add hostname condition to includeIf

From: Eric Sunshine <hidden>
Date: 2024-03-20 16:37:35

On Wed, Mar 20, 2024 at 10:35 AM Chris Torek [off-list ref] wrote:
The suggestion for having `git var` list GIT_HOSTNAME gave me
an idea: perhaps instead of, or in addition to, a `hostname`
condition in the `includeif` code, we could:

 * have an `includeif:env:...` condition that tests an env
   variable against a pattern; and/or
 * use $GIT_HOSTNAME as the variable.

We'd then set `GIT_HOSTNAME` to the gethostname() result *unless*
it's already set.

This gives users much more flexibility, because:

 * they can use the hostname and/or arbitrary-env-var condition;
 * they can then *set* GIT_HOSTNAME to the short or full
   hostname at their discretion if the default is not suitable
   for some reason; and of course
 * they can, as noted, use `git var` to find the default setting.
This certainly is a much more generic approach, and simplifies the
implementation considerably since it obviates the need for
GIT_HOSTNAME (or --show-hostname) since the choice of variable name
and value is fully under the user's control.

I have some vague feeling that this idea of using an environment
variable as a condition may have been discussed before and possibly
rejected due to potential security concerns, but I don't use
`includeif` myself and haven't really followed past discussions, so I
could be wrong about that. Peff would probably have better
recollection.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help