summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2015-07-30 20:43:33 -0700
committerDan Willemsen <dwillemsen@google.com>2015-07-30 21:29:53 -0700
commit2a3e15217ab986abe457808a4f2e35504ded535a (patch)
tree86f77b654aa5cd1a866e40cdd910ac15588da4ec
parentabaa7f312f1b6c8d11d7c757fe909900ce5788b5 (diff)
downloadgit-repo-2a3e15217ab986abe457808a4f2e35504ded535a.tar.gz
Fix _ReferenceGitDir symlinking
This fixes these errors: ... File ".repo/repo/project.py", line 2371, in _ReferenceGitDir os.symlink(os.path.relpath(src, os.path.dirname(dst)), dst) OSError: [Errno 17] File exists Which was happening for checkouts that were created before v1.12.8, when project-objects was created. Nothing had yet been forcing these checkouts to use project-objects, until the recent verification changes. In this OSError case, we already created the symlink, so src == dst, and the directory did not exist. This caused us to run os.makedirs the os.symlink on the same file. dst really should be the file in gitdir, not the target of that symlink if it exists. So just use realpath for the dotgit portion of the path. Change-Id: Iff5396a2093de91029c42cf38aa57131fd22981c
-rw-r--r--project.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/project.py b/project.py
index 868425ce..9cb7542e 100644
--- a/project.py
+++ b/project.py
@@ -2347,10 +2347,11 @@ class Project(object):
2347 if copy_all: 2347 if copy_all:
2348 to_copy = os.listdir(gitdir) 2348 to_copy = os.listdir(gitdir)
2349 2349
2350 dotgit = os.path.realpath(dotgit)
2350 for name in set(to_copy).union(to_symlink): 2351 for name in set(to_copy).union(to_symlink):
2351 try: 2352 try:
2352 src = os.path.realpath(os.path.join(gitdir, name)) 2353 src = os.path.realpath(os.path.join(gitdir, name))
2353 dst = os.path.realpath(os.path.join(dotgit, name)) 2354 dst = os.path.join(dotgit, name)
2354 2355
2355 if os.path.lexists(dst): 2356 if os.path.lexists(dst):
2356 continue 2357 continue