]> git.ipfire.org Git - thirdparty/git.git/commit - t/t1300-config.sh
config: include file if remote URL matches a glob
authorJonathan Tan <jonathantanmy@google.com>
Tue, 18 Jan 2022 17:47:40 +0000 (09:47 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Jan 2022 21:55:53 +0000 (13:55 -0800)
commit399b198489a041e2842fb4b257bea5adb02d28d1
tree3cbbac7cf1c1f46659e0b1d8f238bf51fd1ff0f4
parented69e11b89af41c112ab80f5278a2b29c6f5f5b3
config: include file if remote URL matches a glob

This is a feature that supports config file inclusion conditional on
whether the repo has a remote with a URL that matches a glob.

Similar to my previous work on remote-suggested hooks [1], the main
motivation is to allow remote repo administrators to provide recommended
configs in a way that can be consumed more easily (e.g. through a
package installable by a package manager - it could, for example,
contain a file to be included conditionally and a post-install script
that adds the include directive to the system-wide config file).

In order to do this, Git reruns the config parsing mechanism upon
noticing the first URL-conditional include in order to find all remote
URLs, and these remote URLs are then used to determine if that first and
all subsequent includes are executed. Remote URLs are not allowed to be
configued in any URL-conditionally-included file.

[1] https://lore.kernel.org/git/cover.1623881977.git.jonathantanmy@google.com/

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt
config.c
config.h
t/t1300-config.sh