##// END OF EJS Templates
libgit2: check for dangling commits in get_object method
marcink -
r727:28a01042 default
parent child Browse files
Show More
@@ -600,15 +600,20 b' class GitRemote(object):'
600 600 def get_object(self, wire, sha):
601 601 repo = self._factory.repo_libgit2(wire)
602 602
603 missing_commit_err = 'Commit {} does not exist for `{}`'.format(sha, wire['path'])
603 604 try:
604 605 commit = repo.revparse_single(sha)
605 606 except (KeyError, ValueError) as e:
606 msg = 'Commit {} does not exist for `{}`'.format(sha, wire['path'])
607 raise exceptions.LookupException(e)(msg)
607 raise exceptions.LookupException(e)(missing_commit_err)
608 608
609 609 if isinstance(commit, pygit2.Tag):
610 610 commit = repo.get(commit.target)
611 611
612 # check for dangling commit
613 branches = [x for x in repo.branches.with_commit(commit.hex)]
614 if not branches:
615 raise exceptions.LookupException(None)(missing_commit_err)
616
612 617 commit_id = commit.hex
613 618 type_id = commit.type
614 619
General Comments 0
You need to be logged in to leave comments. Login now