From c16f584725a4cadafc6e113abef45f4ea52d03b3 Mon Sep 17 00:00:00 2001 From: Jeremy Retailleau Date: Wed, 2 Sep 2020 13:55:47 -0700 Subject: Add Regex to match content of "includeIf" section --- git/config.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'git/config.py') diff --git a/git/config.py b/git/config.py index 43f854f2..4de050a5 100644 --- a/git/config.py +++ b/git/config.py @@ -38,6 +38,9 @@ log.addHandler(logging.NullHandler()) # represents the configuration level of a configuration file CONFIG_LEVELS = ("system", "user", "global", "repository") +# Section pattern to detect conditional includes. +# https://git-scm.com/docs/git-config#_conditional_includes +CONDITIONAL_INCLUDE_REGEXP = re.compile(r"(?<=includeIf )\"(gitdir|gitdir/i|onbranch):(.+)\"") class MetaParserBuilder(abc.ABCMeta): -- cgit v1.2.1