Hubert Chathi's fix was confusing for me, so I made a simpler change.
Seems to work so far. The problem was that
os.path.dirname('filename')
returns an empty string ('') if there are no directories in the
filename. So when `git rev-parse --git-dir` returned '.git', os
returned ''. Later programs didn't recognize '' as a valid directory
and crashed. My fix returns '.' in this case, so we don't crash,
and avoid having to use full paths. I'm not sure why I don't want
to use full paths; they just give me bad vibes...
--- /dev/null
+Fixed with a simpler patch.
--- /dev/null
+
+
+
+Content-type=text/plain
+
+
+
+
+
+
+Date=Thu, 13 Nov 2008 19:31:04 +0000
+
+
+
+
+
+
+From=wking
+
+
+
-status=open
+status=closed
"""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."""