summaryrefslogtreecommitdiff
path: root/lib/git/objects/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-11-04 12:46:37 +0100
committerSebastian Thiel <byronimo@gmail.com>2009-11-04 12:46:37 +0100
commitc4cde8df886112ee32b0a09fcac90c28c85ded7f (patch)
tree3331b64af12952d4fb961e0db712192d990c548d /lib/git/objects/base.py
parentf9bbdc87a7263f479344fcf67c4b9fd6005bb6cd (diff)
downloadgitpython-c4cde8df886112ee32b0a09fcac90c28c85ded7f.tar.gz
IndexObject: assured that .path fields are relative to the repository ( previously it would just be a name )
added abspath property and name property to provide easy access to most common paths of an index object
Diffstat (limited to 'lib/git/objects/base.py')
-rw-r--r--lib/git/objects/base.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/git/objects/base.py b/lib/git/objects/base.py
index 6dd03ba4..b0989a43 100644
--- a/lib/git/objects/base.py
+++ b/lib/git/objects/base.py
@@ -196,3 +196,20 @@ class IndexObject(Object):
# END for each char
return mode
+ @property
+ def name(self):
+ """
+ Returns
+ Name portion of the path, effectively being the basename
+ """
+ return os.path.basename(self.path)
+
+ @property
+ def abspath(self):
+ """
+ Returns
+ Absolute path to this index object in the file system ( as opposed to the
+ .path field which is a path relative to the git repository )
+ """
+ return os.path.join(self.repo.git.git_dir, self.path)
+