##// END OF EJS Templates
git: use smarter way for checking if repo is empty. This doesn't spam logs with some dulwich exceptions, we shouldn't really care about here.`
marcink -
r2955:7eb44380 default
parent child Browse files
Show More
@@ -177,9 +177,9 b' class GitRepository(BaseRepository):'
177 # we must check if this repo is not empty, since later command
177 # we must check if this repo is not empty, since later command
178 # fails if it is. And it's cheaper to ask than throw the subprocess
178 # fails if it is. And it's cheaper to ask than throw the subprocess
179 # errors
179 # errors
180 try:
180
181 self._remote.head()
181 head = self._remote.head(show_exc=False)
182 except KeyError:
182 if not head:
183 return []
183 return []
184
184
185 rev_filter = ['--branches', '--tags']
185 rev_filter = ['--branches', '--tags']
@@ -2206,7 +2206,9 b' class Repository(Base, BaseModel):'
2206 if cs_cache is None:
2206 if cs_cache is None:
2207 # use no-cache version here
2207 # use no-cache version here
2208 scm_repo = self.scm_instance(cache=False, config=config)
2208 scm_repo = self.scm_instance(cache=False, config=config)
2209 if scm_repo:
2209
2210 empty = scm_repo.is_empty()
2211 if not empty:
2210 cs_cache = scm_repo.get_commit(
2212 cs_cache = scm_repo.get_commit(
2211 pre_load=["author", "date", "message", "parents"])
2213 pre_load=["author", "date", "message", "parents"])
2212 else:
2214 else:
General Comments 0
You need to be logged in to leave comments. Login now