summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--project.py7
-rw-r--r--subcmds/init.py5
2 files changed, 9 insertions, 3 deletions
diff --git a/project.py b/project.py
index 6ef7d3d3..e4682e6a 100644
--- a/project.py
+++ b/project.py
@@ -1270,7 +1270,8 @@ class Project(object):
1270 try: 1270 try:
1271 fd = open(alt) 1271 fd = open(alt)
1272 try: 1272 try:
1273 alt_dir = fd.readline().rstrip() 1273 # This works for both absolute and relative alternate directories.
1274 alt_dir = os.path.join(self.objdir, 'objects', fd.readline().rstrip())
1274 finally: 1275 finally:
1275 fd.close() 1276 fd.close()
1276 except IOError: 1277 except IOError:
@@ -2361,6 +2362,10 @@ class Project(object):
2361 ref_dir = None 2362 ref_dir = None
2362 2363
2363 if ref_dir: 2364 if ref_dir:
2365 if not os.path.isabs(ref_dir):
2366 # The alternate directory is relative to the object database.
2367 ref_dir = os.path.relpath(ref_dir,
2368 os.path.join(self.objdir, 'objects'))
2364 _lwrite(os.path.join(self.gitdir, 'objects/info/alternates'), 2369 _lwrite(os.path.join(self.gitdir, 'objects/info/alternates'),
2365 os.path.join(ref_dir, 'objects') + '\n') 2370 os.path.join(ref_dir, 'objects') + '\n')
2366 2371
diff --git a/subcmds/init.py b/subcmds/init.py
index eeddca06..47a1c9fa 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -175,7 +175,8 @@ to update the working directory files.
175 if not mirrored_manifest_git.endswith(".git"): 175 if not mirrored_manifest_git.endswith(".git"):
176 mirrored_manifest_git += ".git" 176 mirrored_manifest_git += ".git"
177 if not os.path.exists(mirrored_manifest_git): 177 if not os.path.exists(mirrored_manifest_git):
178 mirrored_manifest_git = os.path.join(opt.reference + '/.repo/manifests.git') 178 mirrored_manifest_git = os.path.join(opt.reference,
179 '.repo/manifests.git')
179 180
180 m._InitGitDir(mirror_git=mirrored_manifest_git) 181 m._InitGitDir(mirror_git=mirrored_manifest_git)
181 182
@@ -401,7 +402,7 @@ to update the working directory files.
401 git_require(MIN_GIT_VERSION, fail=True) 402 git_require(MIN_GIT_VERSION, fail=True)
402 403
403 if opt.reference: 404 if opt.reference:
404 opt.reference = os.path.abspath(os.path.expanduser(opt.reference)) 405 opt.reference = os.path.expanduser(opt.reference)
405 406
406 # Check this here, else manifest will be tagged "not new" and init won't be 407 # Check this here, else manifest will be tagged "not new" and init won't be
407 # possible anymore without removing the .repo/manifests directory. 408 # possible anymore without removing the .repo/manifests directory.