Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » After 4.7.3 upgrade, Eclipse thinks my git config is in a different place
After 4.7.3 upgrade, Eclipse thinks my git config is in a different place [message #1784148] Thu, 22 March 2018 23:35 Go to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 580
Registered: July 2009
Senior Member
In the past, I've noticed some oddities in the git configuration dialog. I have my .gitconfig in "C:\Users\<myuid>", but I often find eGit thinks it's in "H:\". When I've seen this in the past, I was simply able to change the path in the field to the correct one, and it would be fine for a while.

After the 4.7.3 upgrade, it appears that I can't even change this now.

I do have one environment variable that refers to that location, called "HOMEDRIVE". I find it hard to believe eGit uses that.

How do I get eGit to use the config location that I want?
Re: After 4.7.3 upgrade, Eclipse thinks my git config is in a different place [message #1784152 is a reply to message #1784148] Fri, 23 March 2018 00:11 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 580
Registered: July 2009
Senior Member
Is it using the "HOME" environment variable? I'm trying not to set that, because that confuses Cygwin.
Re: After 4.7.3 upgrade, Eclipse thinks my git config is in a different place [message #1784166 is a reply to message #1784152] Fri, 23 March 2018 07:50 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 257
Registered: July 2009
Senior Member
As you see below JGit on windows (if cygwin is not used) is using 1) HOME, 2) HOMEDRIVE/HOMEPATH and 3) HOMESHARE. Be aware that if cygwin is used than the code is again different (see FS_Win32_Cygwin#userHomeImpl())
> git describe
v4.11.0.201803080745-r-60-g901e663a6
> git grep -12 HOMEDRIVE
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-                       }
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-               }
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-               return gitExe;
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-       }
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-       /** {@inheritDoc} */
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-       @Override
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-       protected File userHomeImpl() {
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-               String home = SystemReader.getInstance().getenv("HOME"); //$NON-NLS-1$
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-               if (home != null)
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-                       return resolve(null, home);
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java:               String homeDrive = SystemReader.getInstance().getenv("HOMEDRIVE"); //$NON-NLS-1$
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-               if (homeDrive != null) {
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-                       String homePath = SystemReader.getInstance().getenv("HOMEPATH"); //$NON-NLS-1$
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-                       if (homePath != null)
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-                               return new File(homeDrive, homePath);
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-               }
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-               String homeShare = SystemReader.getInstance().getenv("HOMESHARE"); //$NON-NLS-1$
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-               if (homeShare != null)
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-                       return new File(homeShare);
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-               return super.userHomeImpl();
org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java-       }


Ciao
Chris
Re: After 4.7.3 upgrade, Eclipse thinks my git config is in a different place [message #1784221 is a reply to message #1784166] Fri, 23 March 2018 17:08 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 580
Registered: July 2009
Senior Member
Thanks, but that only confirms that I don't have any choice. I now have a handful of identical .gitconfig files littered around because my tools won't let me specify a single location for it.
Re: After 4.7.3 upgrade, Eclipse thinks my git config is in a different place [message #1784296 is a reply to message #1784221] Mon, 26 March 2018 11:12 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 257
Registered: July 2009
Senior Member
What would you suggest? If the $HOME variable is not set how should (j)git find the users .gitconfig file?

Ciao
Chris
Re: After 4.7.3 upgrade, Eclipse thinks my git config is in a different place [message #1784316 is a reply to message #1784296] Mon, 26 March 2018 16:10 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 580
Registered: July 2009
Senior Member
Well, from the perspective of Eclipse, simply let them specify the location in a config property.
Re: After 4.7.3 upgrade, Eclipse thinks my git config is in a different place [message #1784453 is a reply to message #1784316] Wed, 28 March 2018 07:33 Go to previous message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 257
Registered: July 2009
Senior Member
I think we should find a solution for JGit which is not Eclipse specific. Which of the environment variables HOME, HOMEDRIVE, HOMEPATH, HOMESHARE are set in your environment and how is the system property user.home set in your eclipse. If the code I attached doesn't find enough info in the listed environment variables it will call FS#userHomeImpl(). And this will use the standard system property "user.home". So maybe setting the system property "user.home" in eclipse.ini is sufficient.

Ciao
Chris
Previous Topic:Merging via eclipse
Next Topic:Facing Performance issue with JGIT add command with big repository
Goto Forum:
  


Current Time: Tue Nov 13 05:28:55 GMT 2018

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

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

Back to the top