Skip to content

#1517: configure Git Bash in Windows Terminal during MSI installation#2079

Draft
quando632 wants to merge 2 commits into
devonfw:mainfrom
quando632:feature/msi-for-git-bash
Draft

#1517: configure Git Bash in Windows Terminal during MSI installation#2079
quando632 wants to merge 2 commits into
devonfw:mainfrom
quando632:feature/msi-for-git-bash

Conversation

@quando632

@quando632 quando632 commented Jun 26, 2026

Copy link
Copy Markdown

This PR fixes #1517

Implemented changes:

  • Fixed a NullPointerException in IdeasyCommandlet.configureGitBashProfile(...) that occurred when IDE_ROOT is not yet set, exactly the case during a fresh MSI installation. The code called this.context.getIdeRoot().toString() unconditionally; since the NPE was swallowed by the surrounding try/catch, it was only logged as Failed to configure Git Bash in Windows Terminal: null and the Git Bash profile was never added to Windows Terminal. It now falls back to the user home directory as startingDirectory via Objects.requireNonNullElse(...).
  • This explains why running setup.bat from within an existing project worked (there IDE_ROOT is set), while the MSI installer did not (no IDE_ROOT on a fresh machine).
  • Replaced the single configureWindowsTerminalGitBash test with a @ParameterizedTest that covers both cases (IDE_ROOT set and unset) and fixed an unused SystemInfo variable that was never applied to the test context.
  • Added the issue to CHANGELOG.adoc.

Testing instructions

Automated (proves the fix):

  1. Run the regression test both parameterized runs (IDE_ROOT set + unset) must pass:
    mvn -pl cli -Dtest=IdeasyCommandletTest#testConfigureWindowsTerminalGitBash test

  2. Negative control, re-introduce the bug to confirm the test catches it. In
    cli/src/main/java/com/devonfw/tools/ide/tool/IdeasyCommandlet.java:

  • Line 494, change
    Path startingDirectory = Objects.requireNonNullElse(this.context.getIdeRoot(), this.context.getUserHome());
    back to the buggy version
    String startingDirectory = this.context.getIdeRoot().toString();
  • Line 500, change
    gitBashProfile.put("startingDirectory", startingDirectory.toString());
    to
    gitBashProfile.put("startingDirectory", startingDirectory);

Re-run the command from step 1. The IDE_ROOT == null run now fails: the
NullPointerException is swallowed by the surrounding try/catch and logged as the exact
message from the issue (Failed to configure Git Bash in Windows Terminal: null), so the
Git Bash profile is never written to settings.json. Revert both lines (e.g.
git checkout cli/src/main/java/com/devonfw/tools/ide/tool/IdeasyCommandlet.java) → green again.


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"

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Jun 26, 2026
@quando632 quando632 self-assigned this Jun 26, 2026
@quando632 quando632 added bash bash, zsh, git-bash (integration, scripts) install installation process of IDE + tools and install commandlet bugfix PR that fixes a bug issue labels Jun 26, 2026
@coveralls

coveralls commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 28240448711

Coverage increased (+0.004%) to 71.36%

Details

  • Coverage increased (+0.004%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 42 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

42 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/tool/IdeasyCommandlet.java 42 72.08%

Coverage Stats

Coverage Status
Relevant Lines: 16274
Covered Lines: 12111
Line Coverage: 74.42%
Relevant Branches: 7284
Covered Branches: 4700
Branch Coverage: 64.52%
Branches in Coverage %: Yes
Coverage Strength: 3.15 hits per line

💛 - Coveralls

@quando632 quando632 moved this from 🆕 New to Team Review in IDEasy board Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bash bash, zsh, git-bash (integration, scripts) bugfix PR that fixes a bug issue install installation process of IDE + tools and install commandlet

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

IDEasy MSI does not configure Windows Terminal for git-bash

2 participants