diff options
Diffstat (limited to 'lib/git')
-rw-r--r-- | lib/git/base.py | 10 | ||||
-rw-r--r-- | lib/git/tree.py | 6 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/git/base.py b/lib/git/base.py index f3510558..b7976dab 100644 --- a/lib/git/base.py +++ b/lib/git/base.py @@ -222,9 +222,15 @@ class Ref(object): def name(self): """ Returns - Name of this reference + (shortest) Name of this reference - it may contain path components """ - return os.path.basename(self.path) + # first two path tokens are can be removed as they are + # refs/heads or refs/tags or refs/remotes + tokens = self.path.split('/') + if len(tokens) < 3: + return self.path # could be refs/HEAD + + return '/'.join(tokens[2:]) @classmethod def find_all(cls, repo, common_path = "refs", **kwargs): diff --git a/lib/git/tree.py b/lib/git/tree.py index db4a3e22..597668ae 100644 --- a/lib/git/tree.py +++ b/lib/git/tree.py @@ -47,11 +47,11 @@ class Tree(base.IndexObject): return None if typ == "tree": - return Tree(repo, id=id, mode=mode, path=path) + return Tree(repo, id, mode, path) elif typ == "blob": - return blob.Blob(repo, id=id, mode=mode, path=path) + return blob.Blob(repo, id, mode, path) elif typ == "commit": - return None + return None else: raise(TypeError, "Invalid type: %s" % typ) |