views:

33

answers:

2

I have a project hosted on GitHub and I use Git for source versioning.

I have to pull the code on another platform but it can't have Git, so I am using Subversion Support of GitHub to checkout the code, but it doesn't handle symlinks.

For example, on my machine I have a symlink :

sf -> ../lib/vendor/symfony/data/web/sf

But when the sources are updated on the remote platform, I have this :

$ svn up
# updating sources...
$ cat sf
../lib/vendor/symfony/data/web/sf

Any ideas?

Update

If possible I want to avoid the script solution, other developers may also pull sources from Subversion for example.

A: 

Subversion seems to handle symlinks, but in a tricky way.

For your problem, you could try to reconvert back your symlinks to real ones, for example with some script like this (just showing the idea, untested):

#!/usr/bin/env bash

file=$1
filecontent=`cat $1`
if [[ -f "$filecontent" ]]; then
  svn delete $file --force
  svn commit -m "Deleting broken symlink $file"
  svn update
  ln -s $filecontent $file
  svn add --force $file
  svn commit -m "Recreating broken symlink $file"
fi

The svn instructions sequence comes from this question.

Julien Nicoulaud
Your solution could work, except the fact that I don't want to commit the changes : this is a git repository and the subversion write support for github isn't quite stable currently (http://github.com/blog/644-subversion-write-support).
Romain Deveaud
+1  A: 

Hi,

This IS really what's stored in the history. When Git sees this content in the log, instead of literally putting it in a file like Subversion does, it actually creates a symbolic link (see entry.c:113 for proof). There are two solutions as I see it:

  1. GitHub must detect that this is a symbolic link and represent the it differently through the SVN interface.
  2. You must use some sort of post-receive hook in Subversion to locally detect and replace such files with symbolic links. Don't actually touch the remote repository, otherwise the Git-side will have problems.
Ramkumar Ramachandra
Yeah I noticed that Git handles symlinks that way, GitHub subversion support just seems to need some improvement.Thank you !
Romain Deveaud
You're welcome. On a related note, you might want to see the core.symlinks variable: if it's set to false, it won't create symbolic links corresponding to these files.
Ramkumar Ramachandra