Catch symlink creation failures and report a better error

Some users have noticed that repo doesn't work on VFAT, as we
require a POSIX filesystem with POSIX symlink support.  Catching the
OSError during our symlink creation and raising a GitError with a
more descriptive message will help users to troubleshoot and fix
their own installation problems.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce 2008-11-03 09:59:36 -08:00
parent 23d7781c0b
commit 438ee1cad9

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import errno
import filecmp import filecmp
import os import os
import re import re
@ -864,8 +865,14 @@ class Project(object):
'refs', 'refs',
'rr-cache', 'rr-cache',
'svn']: 'svn']:
try:
os.symlink(os.path.join(relgit, name), os.symlink(os.path.join(relgit, name),
os.path.join(dotgit, name)) os.path.join(dotgit, name))
except OSError, e:
if e.errno == errno.EPERM:
raise GitError('filesystem must support symlinks')
else:
raise
rev = self.GetRemote(self.remote.name).ToLocal(self.revision) rev = self.GetRemote(self.remote.name).ToLocal(self.revision)
rev = self.bare_git.rev_parse('%s^0' % rev) rev = self.bare_git.rev_parse('%s^0' % rev)