Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Calculate file path to local GIT repository with EGit
Calculate file path to local GIT repository with EGit [message #1730752] Thu, 28 April 2016 09:29 Go to next message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
Is it possible to calculate the path to a GIT repository with EGit programmatically?

My problem is that I have an application which can create GUI's and scripts called within Java which are referenced by local Eclipse project paths.

If I export the projects as a project *.zip file other users can import the project and the paths are calculated correctly on different computers and OS's from the workspace path.

However If I transfer the project to a local GIT repository (e.g. to distribute it over Github) the paths can't be updated to the now GIT repository path.

Is there a general way to calculate the paths to a special project repository so that I can ship and distribute a bundled Java project (with file referenced scripts) over, e.g., Github (if EGit installed)?

[Updated on: Thu, 28 April 2016 09:30]

Report message to a moderator

Re: Calculate file path to local GIT repository with EGit [message #1730974 is a reply to message #1730752] Sun, 01 May 2016 09:46 Go to previous message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
After some time I found a hint in the EGit plugin itself:

https://github.com/eclipse/egit/blob/master/org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java

The class RepositoryUtil contains a method to calculate the path to the Git repository which is:

getDefaultRepositoryDir()

However this seems to be not a public API.

One possibility is to fetch the path by a detour over the Activator and the described here:

http://stackoverflow.com/questions/7917825/how-to-create-a-listener-for-git-events-through-the-egit-jgit-plug-in (see answer 2):

org.eclipse.egit.core.Activator.getDefault().getRepositoryUtil().getConfiguredRepositories()

[Updated on: Sun, 01 May 2016 10:29]

Report message to a moderator

Previous Topic:JGIT git dissociate
Next Topic:EGit is showing 401: Unauthorized error when pushing to TFS Git repository
Goto Forum:
  


Current Time: Wed Apr 24 23:13:44 GMT 2024

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

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

Back to the top