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

Bug 346905

Summary: [client] git clone problems when cloning from orion.eclipse.org
Product: [ECD] Orion Reporter: Susan McCourt <susan>
Component: GitAssignee: Project Inbox <orion.git-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P4 CC: ahunter.eclipse, bokowski, john.arthorne, malgorzata.tomczyk, Szymon.Brandys
Version: unspecified   
Target Milestone: 5.0 RC3   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Susan McCourt CLA 2011-05-23 16:47:46 EDT
I was trying to self-host on orion.eclipse.org following the instructions at http://wiki.eclipse.org/Orion/Selfhosting, so I did the following:

- log into orion.eclipse.org
- create a new folder
- go to repositories page and clone the orion client repo into my newly created folder
- prompt for credentials, I entered user name and ssh password
- the progress message told me the clone was complete.  

BUT (BAD)...
1 - there is no clone shown in my list
2 - there are no errors in my console
3 - the target folder has the .git subdirectory but not any of the repo content.

After working with Gosia on this problem, she suggested that I delete the .git subdirectory from my newly created folder.  I tried this.  Still

1 - there is no clone shown in my list

but now the target folder has all the right code in it.

We have git autoinit on, hence the .git subdirectory got created.  Gosia was guessing that there was an error because that subdirectory would have to be overwritten, yet the error was not reported to the user.
Comment 1 Tomasz Zarna CLA 2011-05-24 04:22:06 EDT
(In reply to comment #0)
> - the progress message told me the clone was complete.

If the folder already contained a .git subfolder the message should indicate an error (409 Conflict ?). I missed that case because I have autoinit off. I will look at it after I'm done with bug 346876.
Comment 2 Susan McCourt CLA 2011-05-24 11:26:05 EDT
cc'ing John.
Should we have autoinit on for orion.eclipse.org (and orionhub)?
Note that having it on breaks the self-hosting clone workflow.  One needs to create a folder to receive the clone, and then the clone will fail.
Comment 3 Tomasz Zarna CLA 2011-05-24 11:42:59 EDT
(In reply to comment #2)
> Should we have autoinit on for orion.eclipse.org (and orionhub)?
> Note that having it on breaks the self-hosting clone workflow.

With an eventual fix for this bug this should work, but I still think the question is valid. Would fixing bug 344227 be enough to turn off autoinit on default?
Comment 4 John Arthorne CLA 2011-05-24 13:49:52 EDT
(In reply to comment #2)
> cc'ing John.
> Should we have autoinit on for orion.eclipse.org (and orionhub)?
> Note that having it on breaks the self-hosting clone workflow.  One needs to
> create a folder to receive the clone, and then the clone will fail.

I have disabled "auto git init" on orion.eclipse.org for now. We have some time to decide on the right answer for orionhub. I kind of like the simplicity of "everything is a repository" but it's not a big step for the user to manually init if they want it.
Comment 5 Tomasz Zarna CLA 2011-05-24 15:48:12 EDT
JGit doesn't fail [1] when we try to clone into a folder that already exists and contains a cloned repo inside. msysgit does fail with an error message. I will provide a workaround on our side till [1] is fixed.

btw John, how do I emulate in tests that the preference for default SCM is set to "git"[2]? I tried the code below but it didn't work. When I then try to PreferenceHelper.getString(ServerConstants.CONFIG_FILE_DEFAULT_SCM, "") I get "".

IExportedPreferences testNode = (IExportedPreferences) ExportedPreferences.newRoot().node(ServerConstants.PREFERENCE_SCOPE);
testNode.put(ServerConstants.CONFIG_FILE_DEFAULT_SCM, "git");
Activator.getPreferenceService().applyPreferences(testNode);

[1] http://egit.eclipse.org/r/#change,3518
[2] org.eclipse.orion.server.tests.servlets.git.GitCloneTest.testLinkToFolderWithDefaultSCM()
Comment 6 Tomasz Zarna CLA 2011-05-24 16:18:51 EDT
(In reply to comment #5)
> I will provide a workaround on our side till [1] is fixed.

Applied in http://git.eclipse.org/c/e4/org.eclipse.orion.server.git/commit/?id=542e478ce28dad32f7f6fd91a21c05fef672f866. I'm leaving the bug open to remember about the JGit bug, but I'm removing Target Milestone and reducing Priority. This should no longer cause trouble.
Comment 7 Boris Bokowski CLA 2011-05-25 07:18:00 EDT
(In reply to comment #2)
> Note that having it on breaks the self-hosting clone workflow.  One needs to
> create a folder to receive the clone, and then the clone will fail.

I find it very counterintuitive that I have to first create a folder so that I can then pick that folder as the target for the clone operation. I think I have commented on another bug already that the >80% case should be to automatically create a folder with the same name as the git repository.
Comment 8 Szymon Brandys CLA 2011-05-25 11:53:01 EDT
(In reply to comment #7)
> I think I have
> commented on another bug already that the >80% case should be to automatically
> create a folder with the same name as the git repository.

I think you may just enter a name of a folder to create and it will be created for you during a clone operation. You may even leave all fields blank and enter a Git repo URL, then a project with the name as the repo name will be created for you.
Comment 9 John Arthorne CLA 2011-05-25 11:57:33 EDT
(In reply to comment #5)
> btw John, how do I emulate in tests that the preference for default SCM is set
> to "git"[2]? I tried the code below but it didn't work. When I then try to
> PreferenceHelper.getString(ServerConstants.CONFIG_FILE_DEFAULT_SCM, "") I get
> "".

See CoreFilesTest#testGetForbiddenFiles. In that test I tweak another setting for the purpose of a test. You should be able to use the same code. Just set the value in the instance scope.
Comment 10 Boris Bokowski CLA 2011-05-25 12:59:39 EDT
(In reply to comment #8)
> I think you may just enter a name of a folder to create and it will be created
> for you during a clone operation.

Yes, but I don't want us to show text fields that are optional. They should be hidden behind a "details" or "advanced" option.

> You may even leave all fields blank and enter
> a Git repo URL, then a project with the name as the repo name will be created
> for you.

Cloning a Git repository is part of the initial few seconds of first users of Orion with the tool. The experience has to be as simple and smooth as possible. Uncertainty about "what do I need to enter here?" or "can I leave it blank" will turn those first-time users away.
Comment 11 Tomasz Zarna CLA 2011-05-26 05:02:34 EDT
(In reply to comment #9)
> See CoreFilesTest#testGetForbiddenFiles. In that test I tweak another setting
> for the purpose of a test. You should be able to use the same code. Just set the
> value in the instance scope.

Worked perfectly, thx.
Comment 12 Anthony Hunter CLA 2014-03-13 13:23:00 EDT
(In reply to Boris Bokowski from comment #7)
> I find it very counterintuitive that I have to first create a folder so that
> I can then pick that folder as the target for the clone operation. I think I
> have commented on another bug already that the >80% case should be to
> automatically create a folder with the same name as the git repository.

This issue is no longer occurs, you can simply select the "Create a project from a GIT repository".