Skip to content

#2168: repository remote feature - #2198

Open
QuangAnhLe wants to merge 24 commits into
devonfw:mainfrom
QuangAnhLe:feature/2168-repository-remote-feature
Open

#2168: repository remote feature#2198
QuangAnhLe wants to merge 24 commits into
devonfw:mainfrom
QuangAnhLe:feature/2168-repository-remote-feature

Conversation

@QuangAnhLe

@QuangAnhLe QuangAnhLe commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2168

Implemented changes:

  • Create a new RepositoryRemote record ( similar to RepositotyLink)
  • Add git_remote property parsing to RepositoryProperties
  • Add remotes field to RepositoryConfig
  • Add a addRemote method to ``GitContext interface and implementation
  • Call the remote addition in RepositoryCommandlet after cone/pull and before linking
  • Add tests for a new feature.
  • Changelog entry for the epic : repository remote feature #2168

Testing instructions

Please add conscise, understandable instructions on how a reviewer can test/verify the functionality of your contribution here:

  1. mvn test -pl cli -Dtest="RepositoryPropertiesTest"

Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@CLAassistant

CLAassistant commented Jul 21, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@QuangAnhLe QuangAnhLe self-assigned this Jul 21, 2026
@QuangAnhLe
QuangAnhLe requested a review from hohwille July 21, 2026 15:38
@QuangAnhLe QuangAnhLe moved this from 🆕 New to Team Review in IDEasy board Jul 22, 2026
@QuangAnhLe QuangAnhLe moved this from Team Review to 🏗 In progress in IDEasy board Jul 22, 2026
@quando632 quando632 moved this from 🏗 In progress to Team Review in IDEasy board Jul 22, 2026
@coveralls

coveralls commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 32357586330

Coverage decreased (-0.07%) to 72.872%

Details

  • Coverage decreased (-0.07%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 58 coverage regressions across 5 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

58 previously-covered lines in 5 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/git/GitContextImpl.java 31 34.3%
com/devonfw/tools/ide/git/repository/RepositoryCommandlet.java 15 72.83%
com/devonfw/tools/ide/git/repository/RepositoryProperties.java 9 89.6%
com/devonfw/tools/ide/git/repository/RepositoryConfig.java 2 74.19%
com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java 1 78.69%

Coverage Stats

Coverage Status
Relevant Lines: 17618
Covered Lines: 13388
Line Coverage: 75.99%
Relevant Branches: 7795
Covered Branches: 5131
Branch Coverage: 65.82%
Branches in Coverage %: Yes
Coverage Strength: 3.23 hits per line

💛 - Coveralls

@QuangAnhLe

Copy link
Copy Markdown
Contributor Author

@hohwille If the remotes are automatically created from the git_remote property during repository setup, the onboarding and setup instructions https://github.com/devonfw/IDEasy/blob/main/documentation/contributing/setup.adoc should be updated accordingly, since the manual git remote add upstream step would no longer be required.

@QuangAnhLe QuangAnhLe closed this Jul 23, 2026
@github-project-automation github-project-automation Bot moved this from Team Review to ✅ Done in IDEasy board Jul 23, 2026
@QuangAnhLe QuangAnhLe reopened this Jul 23, 2026
@QuangAnhLe QuangAnhLe moved this from ✅ Done to Team Review in IDEasy board Jul 23, 2026
@QuangAnhLe QuangAnhLe moved this from Team Review to 🏗 In progress in IDEasy board Jul 23, 2026
@Paras14 Paras14 moved this from 🏗 In progress to Team Review in IDEasy board Jul 23, 2026
@Paras14 Paras14 self-assigned this Jul 23, 2026
@Paras14

Paras14 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Hi @QuangAnhLe, thanks for your contribution, a few things that stand out:

  1. git remote add is not idempotent. The loop you added sits after the createRepository check, so it also runs when the repository already exists, meaning every re-run of ide repository setup calls git remote add upstream... again and git fails with "remote already exists". The same happens within a single run when multiple workspaces are configured, since the additional workspaces are symlinks to the first repository. Please check the existing remotes first and only add the remote if it is missing (or update the URL if it differs).

  2. Please rebase onto the current main. GitContextMock was reworked in #1992 improve gitcontextmock #2093 (it now extends GitContextImpl), so your branch currently conflicts in GitContextMock.java. While you are at it, the new mock also lets you record the added remotes so the RepositoryCommandlet part can actually be tested. Right now only the parsing is covered.

  3. The new git_remote property needs to be documented in documentation/repository.adoc, both in the table of variables and in the example .properties block above it.

Also please replace "TodoIssueID" in the PR description with the link to #2168 and adjust the PR title to the form #2168: «brief summary». And the CLA still needs to be signed before this can be merged.

Comment thread cli/src/main/java/com/devonfw/tools/ide/git/GitContext.java Outdated
@hohwille hohwille changed the title Feature/2168 repository remote feature #2168: repository remote feature Jul 27, 2026
@QuangAnhLe
QuangAnhLe force-pushed the feature/2168-repository-remote-feature branch from a5f9cf6 to 6837136 Compare August 4, 2026 15:34
@Paras14

Paras14 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Hi @QuangAnhLe, thanks for the quick turnaround, the fix looks good and GitContextImpl is the right place for it. One thing that stands out:

The get-url probe uses the three argument runGitCommand, which defaults to ProcessErrorHandling.LOG_WARNING. On a first setup the remote does not exist yet, so git exits with an error and we log a warning even though everything is fine. That means the noise is moved from the second run to the first one instead of being gone. Please pass ProcessErrorHandling.NONE for the probe using the four argument overload, a failed lookup there is expected and not a problem.

@QuangAnhLe

Copy link
Copy Markdown
Contributor Author

@Paras14 thanks for your review. I have fixed all the issues you pointed out in the ticket. Could you please do one fine review before we merge it into the main branch?

@Paras14

Paras14 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Hello @QuangAnhLe, Looks good to me.

@Paras14 Paras14 moved this from Team Review to 👀 In review in IDEasy board Aug 6, 2026

@hohwille hohwille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@QuangAnhLe thanks for your PR. This is great work and functionally correct. 👍
I added some code style and design suggestions for further improvements (perfection).
Please have a look and thanks in advance.

Comment thread cli/src/test/java/com/devonfw/tools/ide/git/GitContextMock.java
Comment thread cli/src/main/java/com/devonfw/tools/ide/git/GitContextImpl.java Outdated
Comment thread cli/src/main/java/com/devonfw/tools/ide/git/GitContextImpl.java Outdated
Comment thread cli/src/main/java/com/devonfw/tools/ide/git/GitContextImpl.java Outdated
Comment thread cli/src/main/java/com/devonfw/tools/ide/git/GitContextImpl.java
Comment thread cli/src/main/java/com/devonfw/tools/ide/git/repository/RepositoryProperties.java Outdated
Comment thread cli/src/test/java/com/devonfw/tools/ide/git/GitContextMock.java Outdated
Comment thread cli/src/test/java/com/devonfw/tools/ide/git/GitContextMock.java Outdated
@QuangAnhLe QuangAnhLe added the enhancement New feature or request label Aug 11, 2026
@hohwille hohwille added this to the release:2026.08.002 milestone Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

repository remote feature

7 participants