diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-12-04 14:20:41 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-12-07 10:08:34 +0100 |
commit | f6102b349cbef03667d5715fcfae3161701a472d (patch) | |
tree | e5aecf8797a9c7895c5b2809a6bbf5ee7fb2591a /lib/git/refs.py | |
parent | ac4133f51817145e99b896c7063584d4dd18ad59 (diff) | |
download | gitpython-f6102b349cbef03667d5715fcfae3161701a472d.tar.gz |
Reference: reading of commit data is now safer and handles non-existing paths - previously it would run into a code-branch I forgot
Diffstat (limited to 'lib/git/refs.py')
-rw-r--r-- | lib/git/refs.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/git/refs.py b/lib/git/refs.py index cd903174..bedca7b2 100644 --- a/lib/git/refs.py +++ b/lib/git/refs.py @@ -112,6 +112,9 @@ class SymbolicReference(object): # END for each packed ref # END handle packed refs + if tokens is None: + raise ValueError("Reference at %r does not exist" % self.path) + # is it a reference ? if tokens[0] == 'ref:': return (None, tokens[1]) @@ -417,7 +420,6 @@ class SymbolicReference(object): def _iter_items(cls, repo, common_path = None): if common_path is None: common_path = cls._common_path_default - rela_paths = set() # walk loose refs @@ -516,7 +518,7 @@ class Reference(SymbolicReference, LazyMixin, Iterable): """ if not path.startswith(self._common_path_default+'/'): - raise ValueError("Cannot instantiate %s from path %s" % ( self.__class__.__name__, path )) + raise ValueError("Cannot instantiate %r from path %s" % ( self.__class__.__name__, path )) super(Reference, self).__init__(repo, path) |