git: don't list all commits to check for an empty repo (#5075)

Saves us around 2sec (from ~7.5 to ~5.5) when parsing gitlab repo.
This commit is contained in:
Ruslan Kuprieiev
2020-12-10 14:40:27 +02:00
committed by GitHub
parent 189e88f1db
commit 1331651fe1
+1 -1
View File
@@ -285,7 +285,7 @@ class Git(Base):
@property
def no_commits(self):
return not self.list_all_commits()
return not bool(self.get_ref("HEAD"))
def _backend_func(self, name, *args, **kwargs):
for backend in self.backends.values():