| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,6 +112,9 @@ def _get_ref_info(self): | |||
| 112 | 112 | # END for each packed ref | |
| 113 | 113 | # END handle packed refs | |
| 114 | 114 | ||
| 115 | + if tokens is None: | ||
| 116 | + raise ValueError("Reference at %r does not exist" % self.path) | ||
| 117 | + | ||
| 115 | 118 | # is it a reference ? | |
| 116 | 119 | if tokens[0] == 'ref:': | |
| 117 | 120 | return (None, tokens[1]) | |
@@ -417,7 +420,6 @@ def rename(self, new_path, force=False): | |||
| 417 | 420 | def _iter_items(cls, repo, common_path = None): | |
| 418 | 421 | if common_path is None: | |
| 419 | 422 | common_path = cls._common_path_default | |
| 420 | - | ||
| 421 | 423 | rela_paths = set() | |
| 422 | 424 | ||
| 423 | 425 | # walk loose refs | |
@@ -516,7 +518,7 @@ def __init__(self, repo, path): | |||
| 516 | 518 | ||
| 517 | 519 | """ | |
| 518 | 520 | if not path.startswith(self._common_path_default+'/'): | |
| 519 | - raise ValueError("Cannot instantiate %s from path %s" % ( self.__class__.__name__, path )) | ||
| 521 | + raise ValueError("Cannot instantiate %r from path %s" % ( self.__class__.__name__, path )) | ||
| 520 | 522 | super(Reference, self).__init__(repo, path) | |
| 521 | 523 | ||
| 522 | 524 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,7 +135,7 @@ def _has_lock(self): | |||
| 135 | 135 | pid = int(fp.read()) | |
| 136 | 136 | fp.close() | |
| 137 | 137 | except IOError: | |
| 138 | - raise AssertionError("GitConfigParser has a lock but the lock file at %s could not be read" % lock_file) | ||
| 138 | + raise AssertionError("The lock file at %s could not be read" % lock_file) | ||
| 139 | 139 | ||
| 140 | 140 | if pid != os.getpid(): | |
| 141 | 141 | raise AssertionError("We claim to own the lock at %s, but it was not owned by our process: %i" % (lock_file, os.getpid())) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -274,6 +274,10 @@ def test_head_reset(self, rw_repo): | |||
| 274 | 274 | assert ref_new_name.object == orig_obj | |
| 275 | 275 | assert ref_new_name == ref | |
| 276 | 276 | # END for each name type | |
| 277 | + | ||
| 278 | + # References that don't exist trigger an error if we want to access them | ||
| 279 | + self.failUnlessRaises(ValueError, getattr, Reference(rw_repo, "refs/doesntexist"), 'commit') | ||
| 280 | + | ||
| 277 | 281 | # exists, fail unless we force | |
| 278 | 282 | ex_ref_path = far_away_head.path | |
| 279 | 283 | self.failUnlessRaises(OSError, ref.rename, ex_ref_path) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments