diff options
author | Jeremy Retailleau <jeremy.retailleau@gmail.com> | 2020-09-03 11:11:34 -0700 |
---|---|---|
committer | Jeremy Retailleau <jeremy.retailleau@gmail.com> | 2020-09-03 11:11:34 -0700 |
commit | 3787f622e59c2fecfa47efc114c409f51a27bbe7 (patch) | |
tree | d0220b06beb542e18ffb62161720af801a1e43ba /git/config.py | |
parent | 2c4dec45d387ccebfe9bd423bc8e633210d3cdbd (diff) | |
download | gitpython-3787f622e59c2fecfa47efc114c409f51a27bbe7.tar.gz |
Reformat code to remove unnecessary indentation
Diffstat (limited to 'git/config.py')
-rw-r--r-- | git/config.py | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/git/config.py b/git/config.py index f9a5a46b..b49f0790 100644 --- a/git/config.py +++ b/git/config.py @@ -464,35 +464,37 @@ class GitConfigParser(with_metaclass(MetaParserBuilder, cp.RawConfigParser, obje paths += self.items(section) match = CONDITIONAL_INCLUDE_REGEXP.search(section) - if match is not None and self._repo is not None: - keyword = match.group(1) - value = match.group(2).strip() - - if keyword in ["gitdir", "gitdir/i"]: - value = osp.expanduser(value) - - if not any(value.startswith(s) for s in ["./", "/"]): - value = "**/" + value - if value.endswith("/"): - value += "**" - - # Ensure that glob is always case insensitive if required. - if keyword.endswith("/i"): - value = re.sub( - r"[a-zA-Z]", - lambda m: "[{}{}]".format( - m.group().lower(), - m.group().upper() - ), - value - ) - - if fnmatch.fnmatchcase(self._repo.git_dir, value): - paths += self.items(section) - - elif keyword == "onbranch": - if fnmatch.fnmatchcase(self._repo.active_branch.name, value): - paths += self.items(section) + if match is None or self._repo is None: + continue + + keyword = match.group(1) + value = match.group(2).strip() + + if keyword in ["gitdir", "gitdir/i"]: + value = osp.expanduser(value) + + if not any(value.startswith(s) for s in ["./", "/"]): + value = "**/" + value + if value.endswith("/"): + value += "**" + + # Ensure that glob is always case insensitive if required. + if keyword.endswith("/i"): + value = re.sub( + r"[a-zA-Z]", + lambda m: "[{}{}]".format( + m.group().lower(), + m.group().upper() + ), + value + ) + + if fnmatch.fnmatchcase(self._repo.git_dir, value): + paths += self.items(section) + + elif keyword == "onbranch": + if fnmatch.fnmatchcase(self._repo.active_branch.name, value): + paths += self.items(section) return paths |