aboutsummaryrefslogtreecommitdiffstats
path: root/.be/bugs/0cad2ac6-76ef-4a88-abdf-b2e02de76f5c/comments/17a2217e-fc1d-4d7a-a569-4fd2a4a2261e/body
blob: 49fe1fb29fbeb03c5fb64c0c6a72c61e336f0f27 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
It looks like the problems with the git backend are more than just in the
site-init command.  It looks like several places expect that git_dir_for_path
and git_repo_for_path return absolute paths, while in the current
implementation, it may not be the case.  Here is an updated patch to fix this.
This replaces the previous patch that I gave in this bug.  It seems to work for
me, but I haven't heavily tested it.

--- libbe/git.py	2008-06-22 19:52:14.000000000 -0400
+++ /libbe/git.py	2008-06-23 22:39:17.000000000 -0400
@@ -102,11 +102,16 @@
     """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))
+    # "git rev-parse --show-cdup" gives the relative path to the top-level
+    # directory of the repository.  We then join that to the requested path,
+    # and then use realpath to turn it into an absolute path and to get rid of
+    # ".." components.
+    return os.path.realpath(os.path.join(path,invoke_client("rev-parse", "--show-cdup", directory=path)[1].rstrip()))
 
 def git_dir_for_path(path):
     """Find the git-dir of the deepest repo containing path."""
-    return invoke_client("rev-parse", "--git-dir", directory=path)[1].rstrip()
+    repo = git_repo_for_path(path)
+    return os.path.join(repo,invoke_client("rev-parse", "--git-dir", directory=repo)[1].rstrip())
 
 def export(spec, bug_dir, revision_dir):
     """Check out commit 'spec' from the git repo containing bug_dir into