Bug 488137 - RepositoryUtil.addConfiguredRepository() / FileKey.isGitRepository() don't support gitfile mechanism
Summary: RepositoryUtil.addConfiguredRepository() / FileKey.isGitRepository() don't su...
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-19 15:59 EST by David Eberlein CLA
Modified: 2016-03-19 10:58 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Eberlein CLA 2016-02-19 15:59:16 EST
After importing a Project into the Eclipse Workspace Buckminster uses EGit's / JGit's functionality to link the Project with GIT if it detects a file or folder named .git in it.
In our case we are using > 1.7.8 submodules which use the gitfile mechanism to reference the actual git repo in the .git/modules dir of the parent folder.
Before linking the project the EGit method RepositoryUtil.addConfiguredRepository checks if the directory is a valid git repo by calling JGit's FileKey.isGitRepository. Since ".git" isn't a directory but a file linking to the actual directory using the git file mechanism this check however fails raising a runtime exception in EGits code.
I am not sure if the bug should be fixed in the EGit or JGit part of the code but I do believe it is a bug.

I Also filed this bug for JGit (Bug 488136) because I wasn't sure which project it should be solved in so please just close the wrong one.

Here more details on the gitfile mechanism taken from the git changelog:

Since git 1.7.8:

``When populating a new submodule directory with "git submodule init",
the $GIT_DIR metainformation directory for submodules is created inside
$GIT_DIR/modules/<name>/ directory of the superproject and referenced
via the gitfile mechanism. This is to make it possible to switch
between commits in the superproject that has and does not have the
submodule in the tree without re-cloning.''
Comment 1 Thomas Wolf CLA 2016-03-19 10:58:50 EDT
I don't know what Buckminster does.

RepositoryUtil.addConfiguredRepository() is intended to work with git *directories*. In fact, it's most likely not a good idea to register a submodule as "configured repository". "Configured repositories" are those that are visible in the Repositories view. If you have both the parent and the submodule there as top-level "configured repositories", you're likely to run into problems if you then delete the parent repository. Or if you just remove it from the view, and choose to also remove its projects from the workspace.

In the ongoing submodule support improvements I'm currently doing I took care not to register submodules as "configured" repositories because of that. See https://git.eclipse.org/r/#/c/68417/ (merged 2016-03-17).

Perhaps that already solves your problem? Can you try with an EGit nightly build?

If not: can you give a more precise description of what exactly is done by Buckminster? Then I cold take a look and maybe figure out what exactly EGit should do in that case. Or maybe Buckminster should do something different...