aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-11-16 14:54:52 -0500
committerW. Trevor King <wking@drexel.edu>2008-11-16 14:54:52 -0500
commitfd4678b2c6c46488b1c0922e4b737ce908e29abd (patch)
tree67a6bc62f49cdce444928936241d14fd0460db77 /libbe
parent4bc4079e6d1495f47398a6b685f45fe40e304a0c (diff)
parentf6253f4c6ba301954a5b9beed4e5b41e74bb8004 (diff)
downloadbugseverywhere-fd4678b2c6c46488b1c0922e4b737ce908e29abd.tar.gz
Merged in my git.py changed fixing Hubert Chathi's git set-root bug (0cad).
Diffstat (limited to 'libbe')
-rw-r--r--libbe/git.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/libbe/git.py b/libbe/git.py
index 398585f..172c324 100644
--- a/libbe/git.py
+++ b/libbe/git.py
@@ -22,7 +22,11 @@ def strip_git(filename):
# Find the base path of the GIT tree, in order to strip that leading
# path from arguments to git -- it doesn't like absolute paths.
if os.path.isabs(filename):
- filename = filename[len(git_repo_for_path('.'))+1:]
+ absRepoDir = os.path.abspath(git_repo_for_path('.'))
+ absRepoSlashedDir = os.path.join(absRepoDir,"")
+ assert filename.startswith(absRepoSlashedDir), \
+ "file %s not in git repo %s" % (filename, absRepoSlashedDir)
+ filename = filename.lstrip(absRepoSlashedDir)
return filename
def invoke_client(*args, **kwargs):
@@ -102,7 +106,10 @@ def git_repo_for_path(path):
"""Find the root of the deepest repository containing path."""
# Assume that nothing funny is going on; in particular, that we aren't
# dealing with a bare repo.
- return os.path.dirname(git_dir_for_path(path))
+ dirname = os.path.dirname(git_dir_for_path(path))
+ if dirname == '' : # os.path.dirname('filename') == ''
+ dirname = '.'
+ return dirname
def git_dir_for_path(path):
"""Find the git-dir of the deepest repo containing path."""