Community
Participate
Working Groups
I'm building a web service where I use JGit. Many users share the same JVM and the system property "user.home" can not be used to identify the directory where user data is stored. At present, I use a fairly ugly workaround where I do: Field f_userHome = FS.class.getDeclaredField("userHome"); f_userHome.setAccessible(true); f_userHome.set(FS.DETECTED, wantedUserHome); It would be nice to have a more supported way to accomplish this. Ideally, it should be possible to set this per jgit instance instead of globally.
(In reply to comment #0) > It would be nice to have a more supported way to accomplish this. Ideally, it > should be possible to set this per jgit instance instead of globally. What do you mean by "per jgit instance"? Per-repository? I guess that would be per-FS instance, and you need to configure the RepositoryBuilder with your custom FS that knows what userHome is.
I'm don't know what the best implementation would be. My basic problem is that I cannot rely on system properties since all users share the same VM. I think that's a very common case for any web service so it would be a really great feature to have an alternative solution given that JGit it's ideal for the job (pure Java in servlet container).
I think this 4 part series resolves this request: http://egit.eclipse.org/r/2709 http://egit.eclipse.org/r/2710 http://egit.eclipse.org/r/2711 http://egit.eclipse.org/r/2712 Especially the last two, because you can now do: static final FS mine = FS.DETECTED.newInstance().setUserHome(...); Repository db = new FileRepositoryBuilder().setFS(mine)....build();
These changes are now merged in. Thanks Shawn.