Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » EGit and Google repo not working on Windows with Cygwin(EGit (version > 1.1.0) does not work with repo managed repositories on Windows with Cygwin due to the use of symlinks.)
EGit and Google repo not working on Windows with Cygwin [message #904840] Wed, 29 August 2012 08:57 Go to next message
Ken Wenzel is currently offline Ken WenzelFriend
Messages: 51
Registered: July 2009
Member
Hello,

we are using repo on Windows with Cygwin to manage multiple git repositories for our projects.
Repo mirrors a set of git repositories in its .repo/projects directory (e.g. .repo/projects/com.google.inject) and then creates folders for each project (e.g. com.google.inject) where the files under .git are symlinked to the corresponding repository in .repo/projects.

For example, the git config file 'com.google.inject/.git/config' would be linked in the following way:
config -> ../../.repo/projects/com.google.inject.git/config

If the project 'com.google.inject' is imported into Eclipse with an EGit version > 1.1.0 the following exception occurs:
java.lang.IllegalArgumentException: Repository config file D:\Projekte\komma_rap\com.google.inject\.git\config invalid Cannot read file D:\Projekte\komma_rap\com.google.inject\.git\config
	at org.eclipse.jgit.lib.BaseRepositoryBuilder.loadConfig(BaseRepositoryBuilder.java:680)
	at org.eclipse.jgit.lib.BaseRepositoryBuilder.getConfig(BaseRepositoryBuilder.java:655)
	at org.eclipse.jgit.lib.BaseRepositoryBuilder.guessWorkTreeOrFail(BaseRepositoryBuilder.java:691)
	at org.eclipse.jgit.lib.BaseRepositoryBuilder.setupWorkTree(BaseRepositoryBuilder.java:621)
	at org.eclipse.jgit.lib.BaseRepositoryBuilder.setup(BaseRepositoryBuilder.java:552)
	at org.eclipse.jgit.storage.file.FileRepository.<init>(FileRepository.java:131)
	at org.eclipse.egit.core.RepositoryCache.lookupRepository(RepositoryCache.java:52)
	...

While EGit version 1.1.0 is able to handle the project with symlinks, it seems that there was a change in JGit which prevents this from working on Windows (there are no problems under Ubuntu).

Do you have any suggestions for me?

Best regards,
Ken Wenzel

[Updated on: Fri, 31 August 2012 11:55]

Report message to a moderator

Re: EGit and Google repo not working on Windows XP [message #904845 is a reply to message #904840] Wed, 29 August 2012 09:08 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
- how do you symlink on Windows XP ?
- JGit doesn't support symlinks yet [1]

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=354367
Re: EGit and Google repo not working on Windows XP [message #904865 is a reply to message #904845] Wed, 29 August 2012 09:39 Go to previous messageGo to next message
Ken Wenzel is currently offline Ken WenzelFriend
Messages: 51
Registered: July 2009
Member
- how do you symlink on Windows XP ?

I use a Cygwin environment for git, repo (with python) and also some basic tools like ln. The resulting symlink files start with:
!<symlink>ÿþ

- JGit doesn't support symlinks yet [1]

I do not mean symlinks contained in a git repository but
symlinks to a git repository (e.g. linked git config files as in my example above).

This works with EGit and JGit in version 1.1.0 under Windows XP but stopped working with newer versions. It also works under Ubuntu with any newer version of EGit.

[Updated on: Wed, 29 August 2012 09:41]

Report message to a moderator

Re: EGit and Google repo not working on Windows XP [message #905871 is a reply to message #904865] Fri, 31 August 2012 08:34 Go to previous messageGo to next message
Ken Wenzel is currently offline Ken WenzelFriend
Messages: 51
Registered: July 2009
Member
I sorted it out on my own.

Ten months ago, there was a change in JGit, particularly in the class org.eclipse.jgit.util.FS_Win32_Cygwin.java, with the following commit message:
Do not resolve path using cygwin unless told to

The system property jgit.usecygpath must be set to true in order
for cygwin's cygpath to be used to translate path from cygwin
namespace to Windows namespace.

The cygwin path translation should be considered deprecated.

Bug: 353389
Change-Id: I2b5234c0ab936dac67d1e232f4cd28331bf3226d


This is a fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=353389
that was mainly made for reasons of performance.

Unfortunately, the system property "jgit.usecygpath" seems to be not documented
neither in JGit nor in EGit. Maybe you could document this for Cygwin users?

Thank you and best regards,

Ken
Re: EGit and Google repo not working on Windows XP [message #906000 is a reply to message #905871] Fri, 31 August 2012 12:35 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
Registered: July 2009
Senior Member
Ken Wenzel skrev 2012-08-31 10.34:
> I sorted it out on my own.
>
> Ten months ago, there was a change in JGit, particularly in the class org.eclipse.jgit.util.FS_Win32_Cygwin.java, with the following commit message:
>
> Do not resolve path using cygwin unless told to
>
> The system property jgit.usecygpath must be set to true in order
> for cygwin's cygpath to be used to translate path from cygwin
> namespace to Windows namespace.
>
> The cygwin path translation should be considered deprecated.
>
> Bug: 353389
> Change-Id: I2b5234c0ab936dac67d1e232f4cd28331bf3226d
>
> This is a fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=353389
> that was mainly made for reasons of performance.
>
> Unfortunately, the system property "jgit.usecygpath" seems to be not documented neither in JGit nor in EGit. Maybe you could document this for Cygwin users?

We removed it because it was mostly unhelpful and performance is awful

Since it's deprecated you should only use it if you know you need it and what
it does. I'd rather delete it than document it. If someone really wants path
translation in cygwin work, [s]he need to rewrite the code for better
performance and accuracy (I'm not convinced it actually works as intended).

-- robin
Re: EGit and Google repo not working on Windows XP [message #907084 is a reply to message #906000] Mon, 03 September 2012 09:07 Go to previous message
Ken Wenzel is currently offline Ken WenzelFriend
Messages: 51
Registered: July 2009
Member
Thank you for this information.
Removing the Cygwin path translation would prevent us from using EGit on Windows since almost all of our projects are managed with repo.

I've seen that the slime project uses an always running dedicated process for the Cygwin path translation:
http://code.google.com/p/slime/source/browse/rhino/file/java/inonit/script/runtime/io/cygwin/
The Java side uses stdin/stdout to communicate with this helper process.
Maybe there is a problem if this approach is used in a multi-threaded environment.

Another option for improving the performance could be to detect if a file is a Cygwin symlink (e.g. if it starts with !<symlink>) and then only call cygpath for these symlinks and files that start with "/cygdrive/...". This would require to read every file beforehand, but should be faster than invoking the cygpath process for every file.

Finally, one could also try to use JNI to directly invoke
http://cygwin.com/cygwin-api/func-cygwin-conv-path.html,
but there seem to be some problems when calling Cygwin functions from Java:
http://elliotth.blogspot.de/2005/08/porting-jni-code-to-win32-with-cygwin.html
Previous Topic:Eclipse Mylyn Connector
Next Topic:Merge tool disabled on conflict mode
Goto Forum:
  


Current Time: Sat Apr 20 03:21:06 GMT 2024

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

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

Back to the top