Skip to content

Commit 5db2e0c

Browse files
dongs0104Byron
authored andcommitted
fix: wrong refs 'HEAD' exception
1 parent dbf3d27 commit 5db2e0c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎git/objects/submodule/base.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
from git.exc import (
2121
InvalidGitRepositoryError,
2222
NoSuchPathError,
23-
RepositoryDirtyError
23+
RepositoryDirtyError,
24+
BadName
2425
)
2526
from git.objects.base import IndexObject, Object
2627
from git.objects.util import Traversable
@@ -1153,10 +1154,10 @@ def children(self):
11531154
@classmethod
11541155
def iter_items(cls, repo, parent_commit='HEAD'):
11551156
""":return: iterator yielding Submodule instances available in the given repository"""
1156-
pc = repo.commit(parent_commit) # parent commit instance
11571157
try:
1158+
pc = repo.commit(parent_commit) # parent commit instance
11581159
parser = cls._config_parser(repo, pc, read_only=True)
1159-
except IOError:
1160+
except (IOError, BadName):
11601161
return
11611162
# END handle empty iterator
11621163

0 commit comments

Comments
 (0)