Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 358140

Summary: Import Team Project Set (*.psf) creates second repository
Product: [Technology] EGit Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: Robin Stocker <robin>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aleherb+eclipse, daniel_megert, lucas.panjer, remy.suen, robin, tomasz.zarna
Version: 1.1   
Target Milestone: 2.2-M2   
Hardware: All   
OS: All   
Whiteboard:

Description Markus Keller CLA 2011-09-19 13:23:04 EDT
Latest nightly

Import Team Project Set (*.psf) creates a second repository at a wrong root location.

- have the Git default repository folder set to "<path-to-workspace>/git"
- have user@git.eclipse.org:/gitroot/jdt/eclipse.jdt.git cloned into
"<path-to-workspace>/git/eclipse.jdt"
- import project org.eclipse.jdt-feature
- export into Team Project Set
- delete project org.eclipse.jdt-feature (do not delete contents on disk)
- import Team Project Set
=> Problems:
a) I'm not asked for a location where to clone the repository
b) I'm not asked whether I want to check out from the existing repository clone that is already known to the workspace
Comment 1 Dani Megert CLA 2011-09-20 02:12:36 EDT
See also bug 356194 comment 2 where Git got confused after deleting projects from the workspace that exist in the working directory.
Comment 2 Markus Keller CLA 2012-09-10 15:10:40 EDT
ProjectReferenceImporter#getWorkingDir(..) wrongly tries to find a repo in the workspace location.

It should:
1) check all repos that are known to the Git Repositories view
2) look at the default repository location as defined in Preferences > Git

Fix for (1) is to insert this at the beginning of getWorkingDir(..):

List<String> repoPaths = Activator.getDefault().getRepositoryUtil().getConfiguredRepositories();
for (String repoPath : repoPaths) {
	File gitDir = new File(repoPath);
	if (repositoryAlreadyExistsForUrl(gitDir, gitUrl))
		return Path.fromOSString(repoPath).removeLastSegments(1);
}

[A clean solution would remove the addition of DOT_GIT_EXT in the caller.]

Fix for (2) needs to move org.eclipse.egit.ui.UIPreferences.DEFAULT_REPO_DIR to the core bundle first.
Comment 3 Robin Stocker CLA 2012-10-04 17:47:04 EDT
Fix for (1): https://git.eclipse.org/r/8056
Comment 5 Dani Megert CLA 2012-11-26 10:14:29 EST
Will you also work on 2)?
Comment 6 Robin Stocker CLA 2012-11-26 18:37:05 EST
(In reply to comment #5)
> Will you also work on 2)?

It doesn't have high priority for me, so if someone else wants to work on it, please go ahead. Maybe we should create a separate bug for it, as it will probably also involve cloning to that location instead of into the workspace.
Comment 7 Dani Megert CLA 2012-11-27 05:23:58 EST
(In reply to comment #4)
> (In reply to comment #3)
> > Fix for (1): https://git.eclipse.org/r/8056
> 
> Merged with
> http://git.eclipse.org/c/egit/egit.git/commit/
> ?id=fb1c182a8f5c4b99a7e72d5d15128c5567a91197

Verified in 2.2.0.201211270014.


(In reply to comment #6)
> (In reply to comment #5)
> > Will you also work on 2)?
> 
> It doesn't have high priority for me, so if someone else wants to work on
> it, please go ahead. Maybe we should create a separate bug for it, as it
> will probably also involve cloning to that location instead of into the
> workspace.

Sounds good. Filed bug 395143 for case 2).