summaryrefslogtreecommitdiff
path: root/lib/git
diff options
context:
space:
mode:
authorunknown <byron@.(none)>2010-07-02 19:34:26 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-07-02 19:38:37 +0200
commita4287f65878000b42d11704692f9ea3734014b4c (patch)
tree75a52b5874e74422e977559af4b0fa32b3c429a1 /lib/git
parentf683c6623f73252645bb2819673046c9d397c567 (diff)
downloadgitpython-a4287f65878000b42d11704692f9ea3734014b4c.tar.gz
win32 compatability adjustments
Diffstat (limited to 'lib/git')
m---------lib/git/ext/gitdb0
-rw-r--r--lib/git/objects/tree.py11
-rw-r--r--lib/git/repo.py5
-rw-r--r--lib/git/util.py5
4 files changed, 13 insertions, 8 deletions
diff --git a/lib/git/ext/gitdb b/lib/git/ext/gitdb
-Subproject b76bac22bbb146a7a82318721147d7a5f831b7e
+Subproject 6c8721a7d5d32e54bb4ffd3725ed23ac5d76a59
diff --git a/lib/git/objects/tree.py b/lib/git/objects/tree.py
index d6e16a31..68c1ef2d 100644
--- a/lib/git/objects/tree.py
+++ b/lib/git/objects/tree.py
@@ -5,7 +5,7 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import util
from base import IndexObject
-
+from git.util import join_path
from blob import Blob
from submodule import Submodule
import git.diff as diff
@@ -17,7 +17,6 @@ from fun import (
from gitdb.util import (
to_bin_sha,
- join
)
__all__ = ("TreeModifier", "Tree")
@@ -152,7 +151,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
"""Iterable yields tuples of (binsha, mode, name), which will be converted
to the respective object representation"""
for binsha, mode, name in iterable:
- path = join(self.path, name)
+ path = join_path(self.path, name)
try:
yield self._map_id_to_type[mode >> 12](self.repo, binsha, mode, path)
except KeyError:
@@ -186,7 +185,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
else:
for info in self._cache:
if info[2] == file: # [2] == name
- return self._map_id_to_type[info[1] >> 12](self.repo, info[0], info[1], join(self.path, info[2]))
+ return self._map_id_to_type[info[1] >> 12](self.repo, info[0], info[1], join_path(self.path, info[2]))
# END for each obj
raise KeyError( msg % file )
# END handle long paths
@@ -231,7 +230,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
def __getitem__(self, item):
if isinstance(item, int):
info = self._cache[item]
- return self._map_id_to_type[info[1] >> 12](self.repo, info[0], info[1], join(self.path, info[2]))
+ return self._map_id_to_type[info[1] >> 12](self.repo, info[0], info[1], join_path(self.path, info[2]))
if isinstance(item, basestring):
# compatability
@@ -254,7 +253,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
# treat item as repo-relative path
path = self.path
for info in self._cache:
- if item == join(path, info[2]):
+ if item == join_path(path, info[2]):
return True
# END for each item
return False
diff --git a/lib/git/repo.py b/lib/git/repo.py
index d9b943cd..62202364 100644
--- a/lib/git/repo.py
+++ b/lib/git/repo.py
@@ -22,6 +22,7 @@ from gitdb.util import (
join,
isdir,
isfile,
+ join,
hex_to_bin
)
import os
@@ -285,9 +286,9 @@ class Repo(object):
if config_level == "system":
return "/etc/gitconfig"
elif config_level == "global":
- return os.path.expanduser("~/.gitconfig")
+ return os.path.normpath(os.path.expanduser("~/.gitconfig"))
elif config_level == "repository":
- return "%s/config" % self.git_dir
+ return join(self.git_dir, "config")
raise ValueError( "Invalid configuration level: %r" % config_level )
diff --git a/lib/git/util.py b/lib/git/util.py
index 54c3414e..fcb50585 100644
--- a/lib/git/util.py
+++ b/lib/git/util.py
@@ -214,6 +214,11 @@ class LockFile(object):
# instead of failing, to make it more usable.
lfp = self._lock_file_path()
try:
+ # on bloody windows, the file needs write permissions to be removable.
+ # Why ...
+ if os.name == 'nt':
+ os.chmod(lfp, 0777)
+ # END handle win32
os.remove(lfp)
except OSError:
pass