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

#312: Added ability to prefer git (ssh) protocol instead of httpsfor cloning repos #625

Closed
wants to merge 26 commits into from

Conversation

diiinesh
Copy link
Contributor

@diiinesh diiinesh commented Sep 17, 2024

Adds #312

  • Introduced GIT_PREFERRED_PROTOCOL property to allow configuration of preferred Git protocol (SSH or HTTPS).
  • Default behavior remains unchanged if the property is not set, using the provided Git URL as is.
  • Implemented GitUrlSyntax enum to manage and convert between SSH and HTTPS URL formats.
  • Updated GitUrl class for URL parsing and protocol conversion based on the property.
  • Added tests to validate URL conversion and ensure no changes for specific domains like GitHub.

… GitUrl.java to process ssh urls as well, and added tests
@diiinesh diiinesh self-assigned this Sep 17, 2024
@coveralls
Copy link
Collaborator

coveralls commented Sep 17, 2024

Pull Request Test Coverage Report for Build 11477617445

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.04%) to 66.841%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/variable/IdeVariables.java 1 96.15%
com/devonfw/tools/ide/context/GitUrl.java 3 71.43%
Totals Coverage Status
Change from base Build 11406095376: 0.04%
Covered Lines: 6293
Relevant Lines: 9071

💛 - Coveralls

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@diiinesh I already had a look even though still in draft mode.
You did already a great job with GitUrlSyntax and the integration into GitContextImpl plus adding a wonderful JUnit test. 👍
I already left some suggestions for improvement and refactoring early on...
Please have a look.

diiinesh and others added 19 commits September 18, 2024 10:42
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
….java

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
…num.java and seperate IdeVariable, moved test functions to GitUrlSyntax.java
# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/context/GitContextImpl.java
…project for git based implementations and its config file
@diiinesh diiinesh marked this pull request as ready for review October 8, 2024 09:46
@alfeilex alfeilex self-requested a review October 9, 2024 15:35
Copy link
Member

@alfeilex alfeilex left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@diiinesh thanks for your rework. 👍
I left some small review comments for improvement.
However, this PR does not integrate the new feature so story #312 is not yet implemented.
You need to change GitContextImpl to actually make use of the new infrastructure that you have created in order to transform the GitUrl before calling the actual git clone command.

Also I would suggest to add GitUrlSyntax.DEFAULT and provide this via default lambda in IdeVariables as default so that you can avoid NullPointerException and do not always need to check if configured GitUrlSyntax is null.

diiinesh and others added 2 commits October 23, 2024 10:41
…itionEnum.java

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
@diiinesh diiinesh assigned alfeilex and unassigned diiinesh Oct 23, 2024
@hohwille hohwille changed the title Added ability to prefer git (ssh) protocol instead of httpsfor cloning repos #312: Added ability to prefer git (ssh) protocol instead of httpsfor cloning repos Oct 26, 2024
@@ -73,6 +75,11 @@ public interface IdeVariables {
/** {@link VariableDefinition} for {@link com.devonfw.tools.ide.context.IdeContext#getProjectName() PROJECT_NAME}. */
VariableDefinitionString PROJECT_NAME = new VariableDefinitionString("PROJECT_NAME", null, c -> c.getProjectName());

/** Preferred Git protocol (HTTPS/SSH) as defined by {@link GitUrlSyntax}. */
VariableDefinitionEnum<GitUrlSyntax> PREFERRED_GIT_PROTOCOL = new VariableDefinitionEnum<>("PREFERRED_GIT_PROTOCOL", null, GitUrlSyntax.class,
c -> GitUrlSyntax.HTTPS
Copy link
Member

Choose a reason for hiding this comment

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

The default should be not to change the URL. Only if the user sets the property explicitly, the URL should be changed.
See #625:

Default behavior remains unchanged if the property is not set, using the provided Git URL as is.

Copy link
Member

Choose a reason for hiding this comment

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

Done in #724

@hohwille
Copy link
Member

This PR is replaced by PR #724 - hence closing.

@hohwille hohwille closed this Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants