Skip to content

Fix bash - #3151

Closed
daxgames wants to merge 17 commits into
cmderdev:mainfrom
daxgames:fix-bash
Closed

daxgames wants to merge 17 commits into
cmderdev:mainfrom
daxgames:fix-bash

Conversation

@daxgames

@daxgames daxgames commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Bash - Fix

When Cmder starts. Bundled Git Bash now runs Cmder through /etc/profile.d/zz-cmder.sh or optionaly /etc/profile.d/zz-cmder_exinit.sh on external git installations after Git Bash’s standard PATH setup. Cmder adds its own folders to PATH while respecting Git Bash’s normal environment, including its native Git bin directory.

  1. vendor/cmder.sh now supplies the shared startup logic. for /etc/profile.d/zz-cmder.sh or optionaly /etc/profile.d/zz-cmder_exinit.sh.
  2. Cmder no longer sources ~/.bashrc itself; it leaves that to Git Bash’s usual startup process.

CMD and PowerShell sessions still load their familiar Cmder profile files. Bash’s startup timing and .bashrc handling change more noticeably so Cmder fits into Git Bash’s regular startup flow.

Additional changes

  • Shared Bash/Mintty setup: Both launchers use one helper for Git discovery, PATH setup, MSYSTEM selection, and launch diagnostics (vendor/lib/lib_git_shell.cmd).
  • External Git hook setup: If external Git for Windows has no Cmder hook, the launcher offers to install one without replacing existing hooks. Choose N to skip this launch or never to save an opt-out for that computer and Git path (vendor/setup_external_git_bash.ps1).
  • Consistent startup diagnostics: Bash and Mintty startup messages now follow debug_output, using a shared console helper.
  • Packaging and regression coverage: Tests verify that shared Bash startup files are packaged, user state is excluded, and the bundled hook is included only in packages that contain Git (scripts/test-build-helpers.ps1, scripts/test-git-layout.ps1).

The PR is focused on Bash and Mintty integration; unrelated Windows Terminal, launcher, and 2.0 packaging changes are already in the base branch.

Trust MINGW_PREFIX/MSYSTEM from Git's own startup instead of always
preferring an external Program Files Git, then prepend Cmder's bin
directories. Run once via a CMDER_EXINIT guard with CMDER_ROOT set by
the caller, support ucrt64/clangarm64 and Zsh, fix the
"Program Files (x86)" path, stop sourcing ~/.bashrc (login files run
after profile.d), restore the native bin after user profiles reset
PATH, and route debug messages through vendor/lib/lib_console.sh
gated by debug_output.
…files

Build the bundled Git Bash hook from the cmder_exinit shim and install
it as zz-cmder.sh so Cmder runs after Git's standard PATH hooks,
including env.sh. Because this hook only ships inside the bundled Git,
it can safely fall back to deriving CMDER_ROOT from the mount root when
bundled Git Bash is launched directly outside Cmder. Replace the old
cmder.sh hook with a placeholder on in-place upgrades so Cmder does not
initialize twice. Fail packaging early when any required Bash startup
file (cmder.sh, cmder_exinit, lib_console.sh,
setup_external_git_bash.ps1) is missing.
Use the common Git shell initializer for discovery, PATH setup, and external Git hook guidance. Keep each launcher focused on starting its shell and logging the launch.
Cover shared launcher setup, Bash startup behavior, and external hook installation. Verify package variants include required startup files and exclude user-owned state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant