diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-11-05 17:59:30 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-11-05 17:59:30 +0100 |
commit | 9ee861ae7a7b36a811aa4b5cc8172c5cbd6a945b (patch) | |
tree | 5d10bf275b67704b8873f1b0bd3cc4d55469d8a3 /lib/git/objects | |
parent | 453995f70f93c0071c5f7534f58864414f01cfde (diff) | |
download | gitpython-9ee861ae7a7b36a811aa4b5cc8172c5cbd6a945b.tar.gz |
Added utilities helping to create proper paths either with slashes or backslashes depending on the operating system
fixed test_refs and test_trees
Many more issues remain though, this is just a first backup commit
Diffstat (limited to 'lib/git/objects')
-rw-r--r-- | lib/git/objects/base.py | 8 | ||||
-rw-r--r-- | lib/git/objects/tree.py | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/git/objects/base.py b/lib/git/objects/base.py index b0989a43..c66263c0 100644 --- a/lib/git/objects/base.py +++ b/lib/git/objects/base.py @@ -4,7 +4,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os -from git.utils import LazyMixin +from git.utils import LazyMixin, join_path_native import utils _assertion_msg_format = "Created object %r whose python type %r disagrees with the acutal git object type %r" @@ -209,7 +209,9 @@ class IndexObject(Object): """ 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 ) + .path field which is a path relative to the git repository ). + + The returned path will be native to the system and contains '\' on windows. """ - return os.path.join(self.repo.git.git_dir, self.path) + return join_path_native(self.repo.git.git_dir, self.path) diff --git a/lib/git/objects/tree.py b/lib/git/objects/tree.py index 27bd84d0..f88096b3 100644 --- a/lib/git/objects/tree.py +++ b/lib/git/objects/tree.py @@ -9,6 +9,7 @@ import blob import base import binascii import git.diff as diff +from git.utils import join_path def sha_to_hex(sha): """Takes a string and returns the hex of the sha within""" @@ -110,7 +111,7 @@ class Tree(base.IndexObject, diff.Diffable): i += 1 # END while not reached NULL name = data[ns:i] - path = os.path.join(self.path, name) + path = join_path(self.path, name) # byte is NULL, get next 20 i += 1 |