Skip to content

#2273: add Git as global tool - #2721

Open
JoelAdbu wants to merge 9 commits into
devonfw:mainfrom
JoelAdbu:feature/2273-integrate-git-as-global-tool
Open

JoelAdbu wants to merge 9 commits into
devonfw:mainfrom
JoelAdbu:feature/2273-integrate-git-as-global-tool

Conversation

@JoelAdbu

@JoelAdbu JoelAdbu commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes #2273

This PR continues the work of #2360.

Implemented changes:

  • Added Git as a global IDEasy tool and registered the Git commandlet.
  • Added Linux installation support through native package managers (apt and zypper).
  • Added Macos installation support through native package manager (brew).
  • Added Windows installation support using the Git for Windows installer with silent installer arguments.
  • Added Windows registry-based detection and uninstall support for Git.
  • Improved Windows registry matching by validating the application's DisplayName.
  • Added generic installer argument support for global tools.
  • Added support for global tools that do not require repository version resolution when installed through the native Linux package manager.
  • Updated the CHANGELOG.

Testing instructions:

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

  1. Build IDEasy and make the local development version available with build-local-dev.sh
  2. For all 3 Linux, Windows and Macos run: ide install git and / or ide uninstall git

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 and not feature/921 fixed setup.bat). If no issue ID exists, title only.
  • 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 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 labelled
    with internal
  • You have not changed any dependency in pom.xml files or otherwise if runtime dependencies changed, you have updated our LICENSE.asciidoc
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

Checklist for tool commandlets

Have you added a new «tool» as commandlet? There are the following additional checks:

  • The tool can be installed automatically (during setup via settings) or via the commandlet call
  • The tool is isolated in its IDEasy project, see Sandbox Principle
  • The new tool is added to the table of tools in LICENSE.asciidoc
  • The new commandlet is a command-wrapper for «tool»
  • Proper help texts for all supported languages are added here
  • The new commandlet installs potential dependencies automatically
  • The variables «TOOL»_VERSION and «TOOL»_EDITION are honored by your commandlet
  • The new commandlet is tested on all platforms it is available for or tested on all platforms that are in scope of the linked issue

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Oct 21, 2026
@JoelAdbu JoelAdbu mentioned this pull request Oct 21, 2026
17 tasks done
@JoelAdbu JoelAdbu added enhancement New feature or request commandlet ide sub-command install installation process of IDE + tools and install commandlet git git version management tool integration labels Oct 21, 2026
@coveralls

coveralls commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 40359028650

Coverage increased (+0.2%) to 75.245%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 252 coverage regressions across 7 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

252 previously-covered lines in 7 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/context/AbstractIdeContext.java 131 71.98%
com/devonfw/tools/ide/git/GitContextImpl.java 51 41.82%
com/devonfw/tools/ide/os/WindowsHelperImpl.java 48 56.36%
com/devonfw/tools/ide/tool/GlobalToolCommandlet.java 12 60.5%
com/devonfw/tools/ide/commandlet/CommandletManagerImpl.java 8 91.88%
com/devonfw/tools/ide/tool/ide/AbstractIdeToolCommandlet.java 1 85.42%
com/devonfw/tools/ide/version/VersionSegment.java 1 90.29%

Coverage Stats

Coverage Status
Relevant Lines: 19810
Covered Lines: 15556
Line Coverage: 78.53%
Relevant Branches: 8823
Covered Branches: 5989
Branch Coverage: 67.88%
Branches in Coverage %: Yes
Coverage Strength: 3.38 hits per line

💛 - Coveralls

- small improvement in log messages
@JoelAdbu JoelAdbu moved this from 🆕 New to Team Review in IDEasy board Oct 21, 2026
JoelAdbu and others added 5 commits October 22, 2026 11:06
- added support for git on mac-os
- improvements
…it-as-global-tool

# Conflicts:
#	CHANGELOG.adoc
#	cli/src/main/java/com/devonfw/tools/ide/commandlet/CommandletManagerImpl.java
#	cli/src/main/java/com/devonfw/tools/ide/tool/GlobalToolCommandlet.java
- added tests for git
@quando632 quando632 self-assigned this Oct 27, 2026

@quando632 quando632 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice continuation of #2360. The isPackageManagerBasedInstallation() and getInstallerArguments() hooks keep Git's OS-specific behaviour in Git instead of the shared base class, and the DisplayName check in WindowsHelperImpl fixes a real mismatch, since a registry search for "Git" also hits keys like GitHub CLI. The new Windows registry tests and the no-Git fallback tests in GitOperationTest cover the tricky branches well.

} else if ((urlsPath != null) && Files.isDirectory(urlsPath)) {
LOG.debug("Git is not available. Using existing URL metadata without updating it.");
} else {
gitContext.findGitRequired();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On a machine without Git and without _ide/urls (a fresh Windows setup, the use case of #2273), ide install git resolves its version via getUrls() and lands here. findGitRequired() then aborts with the new hint "Try running ide install git" from GitContextImpl.java:351, so the user is sent in a circle. Please either keep the download hint without the ide install git advice when the urls repository is missing, or provide a way to get the Git metadata without Git.


if (this.context.getSystemInfo().isLinux()) {
// on Linux global tools are typically installed via the package manager of the OS
if (isPackageManagerBasedInstallation()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This branch conflicts with main: #2500 rewrote computeInstalledEditionAndVersion() so that every non-Windows OS already goes through getInstalledVersionForEdition() and so through getNativePackageVersion(), which already covers macOS for Git. When rebasing, this hunk can be dropped in favour of main's version, and isPackageManagerBasedInstallation() is then only needed in doInstall and resolveVersionForInstall.

return DEFAULT_WINDOWS_GIT_PATH;
}

private boolean isInstallingGit(AbstractCommandlet cmd) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isInstallingGit puts tool-specific knowledge into the generic context and reads InstallCommandlet.tool directly. A generic guard such as getGitContext().findGit() != null around the settings-update check would cover ide install git the same way, without coupling AbstractIdeContext to Git, and would also avoid the same failure for other commands run without Git.

return null;
}

protected List<String> getInstallerArguments() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getInstallerArguments() is a new protected extension point but has no Javadoc, unlike its neighbours such as getNativePackages().

Suggested change
protected List<String> getInstallerArguments() {
/**
* @return the additional arguments passed to the downloaded installer executable (e.g. silent mode flags). The default is an empty {@link List}.
*/
protected List<String> getInstallerArguments() {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commandlet ide sub-command enhancement New feature or request git git version management tool integration install installation process of IDE + tools and install commandlet

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

Integrate git as global tool

4 participants