Community
Participate
Working Groups
Say there's a file "foo/bar" and a UNIX symlink "bar" to the directory "foo", all of which checked into git. A "git status" will show no entries, but EGit's "Staging" view lists "bar" as an "unstaged" change.
This depends on symlink support in JGit, bug 354367.
symlinks aren't yet supported so this is an enhancement request
Now, with the recent improvements for symlink support we can reconsider this as a bug. I found the following problems: - symlinks aren't decorated as such in the staging view, instead they are shown as directory and their target is represented as a file under the directory node - modifying the target of a symlink is shown as a deletion of the old symlink target and an addition of the new symlink target
Created attachment 240392 [details] staging view for a modified symlink * clone egit * cd to org.eclipse.egit.core/src/org/eclipse/egit/core * ln -s ../../../../../../org.eclipse.egit.ui org.eclipse.egit.ui * add and commit the new symlink from EGit * now change the link to point to another target rm org.eclipse.egit.ui ln -s ../../../../../../org.eclipse.egit.ui.test org.eclipse.egit.ui * open staging view
Another problem: handling of the symlinks pointing to the non-existing files is really weird (at least on Eclipse 3.8 with latest nightly egit 3.5): $ln -s ../nada link_to_nada $git status . # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # link_to_nada nothing added to commit but untracked files present (use "git add" to track) Eclipse sees *nothing* in project explorer, staging view also shows nothing. $git add link_to_nada $ git status . # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: link_to_nada # Eclipse sees *nothing* in project explorer, staging view also shows nothing, *until I close/reopen the project*. Now package explorer shows the project as changed (but still doesn't show the link) and staging view shows link_to_nada in both staged/unstaged areas, see attached picture. The staged area shows the right state, the unstaged shows the wrong state. After committing the changes: $git commit -m "added dead link" [master 31360ba] added dead link 1 file changed, 1 insertion(+) create mode 120000 link_to_nada $git status . # On branch master nothing to commit, working directory clean Eclipse staging view shows "link_to_nada" in unstaged area as deleted. Looks like Eclipse (3.8) in general can't handle links pointing to nirvana, and so egit staging view fails here too (because it uses Eclipse resource model and not real file system?).
Created attachment 245370 [details] Staging view showing same link as added and deleted at same time where CLI git shows it as staged for adding.
(In reply to Matthias Sohn from comment #4) > Created attachment 240392 [details] > staging view for a modified symlink > > * clone egit > * cd to org.eclipse.egit.core/src/org/eclipse/egit/core > * ln -s ../../../../../../org.eclipse.egit.ui org.eclipse.egit.ui > * add and commit the new symlink from EGit > * now change the link to point to another target > rm org.eclipse.egit.ui > ln -s ../../../../../../org.eclipse.egit.ui.test org.eclipse.egit.ui > * open staging view It works for me. I can reproduce only in case of wrong org.eclipse.jgit.util.FS. As a reminder the only valid FS to support symlinks is FS_POSIX_Java7. Can you test again with the latest version of EGit ?
(In reply to Andrey Loskutov from comment #6) > Created attachment 245370 [details] > Staging view showing same link as added and deleted at same time where CLI > git shows it as staged for adding. The problem is broken symlinks are not detected by the platform. I raised a bug in Platform resources https://bugs.eclipse.org/bugs/show_bug.cgi?id=443409 to know why such symlinks are not detected and displayed in Eclipse.
(In reply to Axel RICHARD from comment #7) > It works for me. I can reproduce only in case of wrong > org.eclipse.jgit.util.FS. As a reminder the only valid FS to support > symlinks is FS_POSIX_Java7. For completeness, today, MacOS-Java7, Linux-Java7 and Windows-Java7 (with administrator privileges) users can take advantage of symlinks.
Broken symlinks support depends on bug 290318, but a fix for egit is possible without it - if we get rid of ContainerTreeIterator or rewrite it to use java.io instead of org.eclipse.core.resources to iterate over the directory content. Might be I'm overlooking something but I can't get why do we need a dedicated ContainerTreeIterator at all - it limits us to the resources model of Eclipse !?! If I replace it with AdaptableFileTreeIterator everything seems to work *and* I see properly decorated broken symbolic links in the staging view.
Actually fixing bug 484498 would fix this bug too, so I declare this one as a dup of bug 484498. *** This bug has been marked as a duplicate of bug 484498 ***
*** Bug 485026 has been marked as a duplicate of this bug. ***