Skip to content

#840: Git fetch doesn't work with multiple remotes - #2377

Open
Paras14 wants to merge 5 commits into
devonfw:mainfrom
Paras14:840-git-fetch-doesnt-work-with-multiple-remotes
Open

#840: Git fetch doesn't work with multiple remotes#2377
Paras14 wants to merge 5 commits into
devonfw:mainfrom
Paras14:840-git-fetch-doesnt-work-with-multiple-remotes

Conversation

@Paras14

@Paras14 Paras14 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #840

Implemented changes:

  • Removed GitContextImpl.determineRemote. It ran git remote, which lists all remotes, and returned null for any repository with more than one. There is no single "default remote" in git for it to return.
  • Added GitContext.getRemotes returning the List of configured remotes.
  • pullOrClone now checks getRemotes(repository).isEmpty(). Previously a repository with two remotes was reported as "a local git repository with no remote" and the user was asked whether to continue.
  • fetch now resolves a missing remote from branch.<branch>.remote, falling back to origin only when no upstream is configured. This is the same remote isRepositoryUpdateAvailable reads via git rev-parse @{u}. Previously fetch always fell back to origin, so a branch tracking a different remote caused IDEasy to fetch one remote and compare against another, and it could report no settings update when one existed.
  • The failed-fetch warning now logs the remote actually used instead of the unresolved parameter.

Testing instructions

  1. Run mvn clean test. GitContextTest.testRunGitPullWithMultipleRemotes covers a repository with two remotes and fails without this change. testRunGitPullWithoutRemoteAsksToContinue covers a repository with no remote and verifies the question is still asked.

Checklist for this PR

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary»
  • PR top-level comment summaries 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
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labelled with internal
  • You have not changed any dependency in pom.xml files
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Aug 27, 2026
@Paras14 Paras14 self-assigned this Aug 27, 2026
@Paras14 Paras14 moved this from 🆕 New to Team Review in IDEasy board Aug 27, 2026
@Paras14 Paras14 added git git version management tool integration internal Nothing to be added to CHANGELOG, only internal story labels Aug 27, 2026
@majesteSil majesteSil self-assigned this Aug 27, 2026
@Paras14 Paras14 changed the title #840: Replace determineRemote with getRemotes and fetch from tracked remote #840: Git fetch doesn't work with multiple remotes Aug 27, 2026
@coveralls

coveralls commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 33180050789

Coverage decreased (-0.03%) to 73.586%

Details

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

Uncovered Changes

No uncovered changes found.

Coverage Regressions

77 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/git/GitContextImpl.java 76 34.2%
com/devonfw/tools/ide/version/VersionSegment.java 1 90.03%

Coverage Stats

Coverage Status
Relevant Lines: 18363
Covered Lines: 14129
Line Coverage: 76.94%
Relevant Branches: 8138
Covered Branches: 5372
Branch Coverage: 66.01%
Branches in Coverage %: Yes
Coverage Strength: 3.28 hits per line

💛 - Coveralls

@majesteSil

majesteSil commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

nice work on this @Paras14, i tested this on my machine and i looks great to me. can be move onto the next step

@Paras14 Paras14 moved this from Team Review to 👀 In review in IDEasy board Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

git git version management tool integration internal Nothing to be added to CHANGELOG, only internal story

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

git fetch does not work with multiple remotes

3 participants