Community
Participate
Working Groups
At least on Windows, it is very difficult to specify an alternate "GNUPGHOME" path... you must rely on temporarily overriding the APPDATA environment variable. Just in general, it seems the BouncyCastleGpgKeyLocator.findGpgDirectory() is too inflexible, Windows and Linux. So even in a paradigm where Java should not rely on environment variables (such as GNUPGHOME), rather Java properties sourced from in some fashion... it isn't consistent for the Windows implementation. Which is relying on APPDATA env variable. For the Linux implementation, it is... but only if you override the user.home system property, which seems a bit extreme. Can there not be a System property that is the first order of precedence for setting the GPG directory? Perhaps a system property "jgit.gpg.dir"? I cannot commit to it, but I hope I'll be able to submit a patch for consideration at some point.
Yes, this is only a bare-bones implementation. It appears GPG has several ways to define that directory[2]: * ~/.gnupg (default on Linux) * %APPDATA%\gnupg (default on Windows) * Environment variable GNUPGHOME * Windows: registry key HKCU\Software\GNU\GnuPG:HomeDir * Windows: "portable installation", directory given by presence of a file "gpgconf.ctl" next to wherever gpgconf.exe is. * --homedir command line option to gpg-agent. Only the first two (default locations) are implemented. The third (environment variable GNUPGHOME) could be implemented directly as is. The last three are either not accessible to JGit (--homedir on gpg-agent) or platform-specific. For those we could use a Java system property as suggested in comment 0. (It's probably not a good idea to rely on the user setting GNUPGHOME for these cases, as that is known to GPG and might interfere.) Precedence should be system property overrides GNUPGHOME overrides default location. If the user wants to override the system property, he can start his Java application with _JAVA_OPTIONS="-Djgit.gpg.home=...". So by default the first three cases would be handled, and the others would require the user to set the system property. Contributions for this are most welcome! What would also be nice: some public API by which EGit could query or set that directory. Then EGit could provide a preference UI where it could display the default location determined by the above and where the user could define or change that location in the Eclipse UI. [2] https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002dhomedir
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/184189
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/184189 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=ca7a30f231201cdc5acc567f3ef08d1dd4369b44
Wow. Thank you very much. That was a very quick turn around. Much appreciated.