Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » symlinks under git repository are tagged for removal at each commit(symlinks)
symlinks under git repository are tagged for removal at each commit [message #491650] Thu, 15 October 2009 11:49 Go to next message
Alban Browaeys is currently offline Alban Browaeys
Messages: 12
Registered: July 2009
Junior Member
Using EGit under eclipse I have symlinks in a project that are tagged for removal at each commit.
It seems to be due to the fact that eclipse dereferences the symlinks and shows them as directories which are obviously untracked.
Is there a workaround ?
Also could egit be made to support those symlinks to directories as eclipse tells it those are directories when in fact they are not ?
Re: symlinks under git repository are tagged for removal at each commit [message #491715 is a reply to message #491650] Thu, 15 October 2009 14:38 Go to previous messageGo to next message
Shawn O. Pearce is currently offline Shawn O. Pearce
Messages: 82
Registered: July 2009
Member
Alban Browaeys wrote:
> Using EGit under eclipse I have symlinks in a project that are tagged
> for removal at each commit.
> It seems to be due to the fact that eclipse dereferences the symlinks
> and shows them as directories which are obviously untracked. Is there a
> workaround ? Also could egit be made to support those symlinks to
> directories as eclipse tells it those are directories when in fact they
> are not ?

symlinks are a major problem for EGit/JGit.

Java does not provide a way to identify that a given path is a symlink,
nor does it provide a way to read the link to identify the target. Why?
Because some operating systems (*cough* Windows *cough*) don't have a
symlink concept, so trying to support it on systems which do have it
leads to less portable code, and Java is Write Once Test Everywhere.

So, basically we're stuck here. We can't get data about a symlink, only
its target, which means that if the target is an empty directory, we'll
think the link was replaced by an empty directory, which isn't tracked,
so we want to remove the path from the repository.

The *ONLY* way out is to write a JNI shim which can perform a proper
POSIX lstat() and readlink() calls on POSIX systems, so we can read the
state of the symlink. This of course is less portable, we have to build
the JNI module from C and dynamically load it into your JVM. Its
technically possible to implement, and Eclipse some provisions to help
identify which pre-compiled module should be used for your architecture
(its how they load SWT), but we haven't yet reached the point in the
project where it made sense to start relying on native code for features
like this.

Long story short, we know symlinks are a problem, but there's no easy
solution.
Re: symlinks under git repository are tagged for removal at each commit [message #491959 is a reply to message #491650] Fri, 16 October 2009 18:28 Go to previous messageGo to next message
Alban Browaeys is currently offline Alban Browaeys
Messages: 12
Registered: July 2009
Junior Member
Well for my current project there is an easy solution : symfony has pluin:publish-assets task that recreate the symlink. I document it and believe it could be triggered on checkout or update via git hooks (don't have the need right now).

Though this should be documented as it took me quite a while to decipher why those two directory where to be removed then to check on the command line that those where symlinks (eclipse does a good job at hiding symlinks in hte front end).

By the way RSE has a way to detect symbolic links though I don't know if this could be used straight in the resource abstraction.

So not a big issue. I vote for a detection to warn the user, not a full support of symlinks, if one day enough resource could be allocated to the issue.
Re: symlinks under git repository are tagged for removal at each commit [message #574927 is a reply to message #491650] Thu, 15 October 2009 14:38 Go to previous messageGo to next message
Shawn O. Pearce is currently offline Shawn O. Pearce
Messages: 82
Registered: July 2009
Member
Alban Browaeys wrote:
> Using EGit under eclipse I have symlinks in a project that are tagged
> for removal at each commit.
> It seems to be due to the fact that eclipse dereferences the symlinks
> and shows them as directories which are obviously untracked. Is there a
> workaround ? Also could egit be made to support those symlinks to
> directories as eclipse tells it those are directories when in fact they
> are not ?

symlinks are a major problem for EGit/JGit.

Java does not provide a way to identify that a given path is a symlink,
nor does it provide a way to read the link to identify the target. Why?
Because some operating systems (*cough* Windows *cough*) don't have a
symlink concept, so trying to support it on systems which do have it
leads to less portable code, and Java is Write Once Test Everywhere.

So, basically we're stuck here. We can't get data about a symlink, only
its target, which means that if the target is an empty directory, we'll
think the link was replaced by an empty directory, which isn't tracked,
so we want to remove the path from the repository.

The *ONLY* way out is to write a JNI shim which can perform a proper
POSIX lstat() and readlink() calls on POSIX systems, so we can read the
state of the symlink. This of course is less portable, we have to build
the JNI module from C and dynamically load it into your JVM. Its
technically possible to implement, and Eclipse some provisions to help
identify which pre-compiled module should be used for your architecture
(its how they load SWT), but we haven't yet reached the point in the
project where it made sense to start relying on native code for features
like this.

Long story short, we know symlinks are a problem, but there's no easy
solution.
Re: symlinks under git repository are tagged for removal at each commit [message #575022 is a reply to message #491650] Fri, 16 October 2009 18:28 Go to previous messageGo to next message
Alban Browaeys is currently offline Alban Browaeys
Messages: 12
Registered: July 2009
Junior Member
Well for my current project there is an easy solution : symfony has pluin:publish-assets task that recreate the symlink. I document it and believe it could be triggered on checkout or update via git hooks (don't have the need right now).

Though this should be documented as it took me quite a while to decipher why those two directory where to be removed then to check on the command line that those where symlinks (eclipse does a good job at hiding symlinks in hte front end).

By the way RSE has a way to detect symbolic links though I don't know if this could be used straight in the resource abstraction.

So not a big issue. I vote for a detection to warn the user, not a full support of symlinks, if one day enough resource could be allocated to the issue.
Re: symlinks under git repository are tagged for removal at each commit [message #728778 is a reply to message #575022] Fri, 23 September 2011 22:10 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 6
Registered: September 2011
Junior Member
My vote goes for full native lstat & stat support on POSIX systems.

Why?


  1. It's important for EGit to fully support symlinks on POSIX
    ( We cannot assume a user is only using EGit... they may also be using it from the command line )
  2. It's important for EGit to be in-sync with any tracked git repos
    ( Again... command line usage can change repo )
  3. It's important for EGit to be FAST
    (like command line git)


I currently suffer from a bug with a common cause (no native lstat & stat support):
https://bugs.eclipse.org/bugs/show_bug.cgi?id=346079

I'm sure this would make a lot of EGit users on Linux & Mac happy!
Other optimization and solutions applicable for all platforms would also be wonderful!

Thanks,

- James Cuzella
Re: symlinks under git repository are tagged for removal at each commit [message #728782 is a reply to message #728778] Fri, 23 September 2011 22:35 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias Sohn
Messages: 588
Registered: July 2009
Senior Member
See [1] and [2]. Implementing a JNI solution is one possibility but integrating that into the central build is a non-trivial task. We have a couple of JNI changes waiting on egit.eclipse.org for somebody finding the time to integrate them into the central build (I didn't find the time for that yet).

Java 7 brings new possibilities to solve these problems in a more portable way.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=354367
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=353771
Re: symlinks under git repository are tagged for removal at each commit [message #960343 is a reply to message #491650] Sat, 27 October 2012 11:46 Go to previous message
Klemens Ullmann-Marx is currently offline Klemens Ullmann-Marx
Messages: 1
Registered: October 2012
Junior Member
Hello, I just wanted to add, that this is really serious from my point of view.

I'm just investigating on how to migrate a large symfony php project (ullright) from svn to git. eGit would play an important part, because the frontend development parts are performed by "not-so-technical" people like graphical artists and webdesigners. Git command line is not a real option for them.

So sadly, this symlink bug is a real showstopper!

Link to the bugreport: https://bugs.eclipse.org/bugs/show_bug.cgi?id=334137
Previous Topic:Exception on first connection attempt to GitHub
Next Topic:Trouble Adding Existing Local Git Repository
Goto Forum:
  


Current Time: Tue Oct 21 10:33:46 GMT 2014

Powered by FUDForum. Page generated in 0.03221 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software