mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Check that we are not overwriting a local repository when syncing.
If a local git repository exists within the same folder as a new project that is added, when the user syncs the repo, the sync will overwrite the local files under the project's .git repository with its own symlinks. Make sure that we do not overwrite 'normal' files in repo and throw an error when that happens.
This commit is contained in:
parent
b6ea3bfcc3
commit
d63060fc95
@ -1120,7 +1120,10 @@ class Project(object):
|
||||
try:
|
||||
src = os.path.join(self.gitdir, name)
|
||||
dst = os.path.join(dotgit, name)
|
||||
os.symlink(relpath(src, dst), dst)
|
||||
if os.path.islink(dst) or not os.path.exists(dst):
|
||||
os.symlink(relpath(src, dst), dst)
|
||||
else:
|
||||
raise GitError('cannot overwrite a local work tree')
|
||||
except OSError, e:
|
||||
if e.errno == errno.EPERM:
|
||||
raise GitError('filesystem must support symlinks')
|
||||
|
Loading…
Reference in New Issue
Block a user