Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Check that we are not overwriting a local repository when syncing.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Nico Sallembien committed Jan 20, 2010
1 parent b6ea3bf commit d63060f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion project.py
Expand Up @@ -1120,7 +1120,10 @@ def _InitWorkTree(self):
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')
Expand Down

0 comments on commit d63060f

Please sign in to comment.