|
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 |
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 #574927 is a reply to message #491650] |
Thu, 15 October 2009 14:38 |
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.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04051 seconds