diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-11 20:21:22 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-11 20:21:22 +0200 |
commit | 9a119924bd314934158515a1a5f5877be63f6f91 (patch) | |
tree | 927fbe62fe20c62eedf7beed91ac80b10dc60774 /lib/git/base.py | |
parent | 15b9129ec639112e94ea96b6a395ad9b149515d1 (diff) | |
download | gitpython-9a119924bd314934158515a1a5f5877be63f6f91.tar.gz |
fixed issue in Ref.name implementation which would not handle components properly
Diffstat (limited to 'lib/git/base.py')
-rw-r--r-- | lib/git/base.py | 10 |
1 files changed, 8 insertions, 2 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): |