Re: [PATCH v7 2/2] config: include file if remote URL matches a glob
flat view
From: Glen Choo <hidden>
Date: 2021-12-16 21:54:18
Jonathan Tan [off-list ref] writes:
quoted hunk ↗ jump to hunk
diff --git a/Documentation/config.txt b/Documentation/config.txt index 0c0e6b859f..9b3480779e 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt@@ -159,6 +159,33 @@ all branches that begin with `foo/`. This is useful if your branches are organized hierarchically and you would like to apply a configuration to all the branches in that hierarchy. +`hasconfig:remote.*.url:`:: + The data that follows this keyword is taken to + be a pattern with standard globbing wildcards and two + additional ones, `**/` and `/**`, that can match multiple + components. The first time this keyword is seen, the rest of + the config files will be scanned for remote URLs (without + applying any values). If there exists at least one remote URL + that matches this pattern, the include condition is met. ++ +Files included by this option (directly or indirectly) are not allowed +to contain remote URLs. ++ +Note that unlike other includeIf conditions, resolving this condition +relies on information that is not yet known at the point of reading the +condition. A typical use case is this option being present as a +system-level or global-level config, and the remote URL being in a +local-level config; hence the need to scan ahead when resolving this +condition. In order to avoid the chicken-and-egg problem in which +potentially-included files can affect whether such files are potentially +included, Git breaks the cycle by prohibiting these files from affecting +the resolution of these conditions (thus, prohibiting them from +declaring remote URLs).
Putting myself in the shoes of someone who is unfamiliar with the implementation, I think that this becomes clear if you read it enough times (but also, I'm not a good reader), so this is ok. It would be nice for this to be reviewed by someone who is _actually_ unfamiliar, though.