Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance normalize uri #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

scabanovich
Copy link

Changes:

  1. remove tail after .git

  2. In case SSH protocol is used and failed, suggest connecting git anonymously.
    If user cancels, do nothing, just cancel the operation.
    If user confirms,
    a) set git:// instead git@
    b) set host/ instead host:

Steps to reproduce:

  1. Clone https://github.com/jenkinsci/jenkins
  2. Import into Eclipse as a maven project.
  3. Select in cli project in Maven Dependencies javassist-3.19.0.GA.jar and call Maven-> Import project(s) from SCM. 'Select Maven artifacts' press Next, then Finish.
  4. If you have ssh key:
    Expected result: repository will be cloned, and 'Select Maven Projects' page will appear with projects to import.
    Current failure: 'Select Maven Projects' page appears empty.
    Fixed by (1 - remove tail after .git)
  5. If you do not have ssh key:
    Expected result: a dialog 'Auth fail' appears that suggests connecting git anonymously. If accepted, continues as in 4.
    Current failure: 'Select Maven Projects' page appears empty.
    After fix of (1) - failure - system error dialog reporting exception 'Auth failed'.
    Fixed by (1) and (2).

uri = "git://" + uri.substring(4);
}
//2. Replace github.com: with github.com/
String githubDotCom = "github.com";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, improved.

// into
// git://github.com/errai/errai.git
// These 3 distinctions may happen independently in other cases.
String gitPrefix = "git://";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like git@ is actually an ssh:// url which, in github's case, only requires you to have a private key that matches with a ssh public key signature in github settings.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's first attempt connection with SSH, and if it fails, show message that suggests user connecting git anonymously. If user cancels, just do nothing, if user confirms, change URL from git@ into git:// and repeat the attempt.

@fbricon
Copy link
Contributor

fbricon commented Mar 30, 2016

@scabanovich can you please add some unit tests?

@scabanovich
Copy link
Author

Tests are added.

final boolean[] result = new boolean[]{false};
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method run() of type new Runnable(){} must override a superclass method.

This error shows up because the project BREE is J2SE-1.5 and I happen to have a Java 5 JDK, exhibiting the issue.

We should bump the BREE to 1.7, as well as the project version to 0.15.0-SNAPSHOT

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@fbricon
Copy link
Contributor

fbricon commented Apr 4, 2016

Other than the BREE issue and the text to tweak, everything seems to work as advertised

throw new CoreException(new Status(IStatus.ERROR, getClass().getName(), cause.getMessage(), cause));
} catch(IOException e) {
throw new CoreException(new Status(IStatus.ERROR, getClass().getName(), e.getMessage(), e));
} catch(URISyntaxException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use multicatch now

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

1) remove tail after .git

2) In case SSH protocol is used and failed, suggest connecting git anonymously.
If user cancels, do nothing, just cancel the operation.
If user confirms,
a) set git:// instead git@
b) set host/ instead host:

Steps to reproduce:
1. Clone https://github.com/jenkinsci/jenkins
2. Import into Eclipse as a maven project.
3. Select in cli project in Maven Dependencies javassist-3.19.0.GA.jar and call Maven-> Import project(s) from SCM. 'Select Maven artifacts' press Next, then Finish.
4. If you have ssh key:
Expected result: repository will be cloned, and 'Select Maven Projects' page will appear with projects to import.
Current failure: 'Select Maven Projects' page appears empty.
Fixed by (1 - remove tail after .git)
5. If you do not have ssh key:
Expected result: a dialog 'Auth fail' appears that suggests connecting git anonymously. If accepted, continues as in 4.
Current failure: 'Select Maven Projects' page appears empty.
After fix of (1) - failure - system error dialog reporting exception 'Auth failed'.
Fixed by (1) and (2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants