summaryrefslogtreecommitdiff
path: root/git/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/config.py')
-rw-r--r--git/config.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/git/config.py b/git/config.py
index b49f0790..9f09efe2 100644
--- a/git/config.py
+++ b/git/config.py
@@ -493,7 +493,13 @@ class GitConfigParser(with_metaclass(MetaParserBuilder, cp.RawConfigParser, obje
paths += self.items(section)
elif keyword == "onbranch":
- if fnmatch.fnmatchcase(self._repo.active_branch.name, value):
+ try:
+ branch_name = self._repo.active_branch.name
+ except TypeError:
+ # Ignore section if active branch cannot be retrieved.
+ continue
+
+ if fnmatch.fnmatchcase(branch_name, value):
paths += self.items(section)
return paths