Skip to content

fix(): let PowerShell run gitrid when it finds the Git Bash command first - #19

Merged
piyook merged 3 commits into
devfrom
fix/powershell-finds-git-bash-wrapper
Oct 10, 2026
Merged

piyook merged 3 commits into
devfrom
fix/powershell-finds-git-bash-wrapper

Conversation

@piyook

@piyook piyook commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Why

3.1.1 made gitrid a command in Git Bash by writing a wrapper to ~/bin/gitrid. A PowerShell that has ~/bin on its PATH (one started from Git Bash, or by a tool that passes on the Git Bash PATH) finds that file before the gitrid.ps1 of the PowerShell setup. PowerShell can not run a file with no extension, so gitrid did nothing and printed nothing.

A PowerShell window opened in the usual way does not have ~/bin on its PATH and was not affected.

What changed

  • setup_gitbash.sh writes ~/bin/gitrid.ps1 next to the wrapper. Where a folder holds both, PowerShell runs the .ps1. It runs ~/Scripts/gitrid.sh with Git's bin\bash.exe, named in full: a plain bash in PowerShell can be the one of WSL, and usr\bin\bash.exe does not put grep and the rest on the PATH.
  • It is written on Windows only (where cygpath is found).
  • README.md and llms.txt say so.
  • Version 3.1.2.

Tests

  • Three new tests in tests/setup.bats: the .ps1 is written on Windows only; PowerShell with ~/bin on its PATH runs the installed script; a pattern with ^, | and $ arrives as typed and the exit code comes back.
  • The bats job now also runs on windows-latest, in Git Bash. This is its first run there.
  • .gitattributes keeps *.sh and *.bats on LF, which the Windows runner needs and which also covers a clone made with core.autocrlf=true.
  • Locally in Git Bash: 54 tests pass, shellcheck is clean, and Windows PowerShell 5.1 runs the .ps1 too.

🤖 Generated with Claude Code

piyook and others added 3 commits October 10, 2026 15:03
…irst

A PowerShell with ~/bin on its PATH (one started from Git Bash, say)
finds ~/bin/gitrid before the gitrid.ps1 of the PowerShell setup. It can
not run a file with no extension, so gitrid did nothing and printed
nothing.

setup_gitbash.sh now writes ~/bin/gitrid.ps1 next to the wrapper, which
PowerShell runs in its place. It runs the same script with Git's
bin\bash.exe.

The tests run on Windows too, and .gitattributes keeps the shell scripts
and tests on LF line endings there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The checkout the workflow tests run in has no main branch, so gitrid
stopped with exit code 1 before it looked at the pattern.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@piyook
piyook merged commit c64e54c into dev Oct 10, 2026
4 checks passed
@piyook piyook mentioned this pull request Oct 10, 2026
@piyook
piyook deleted the fix/powershell-finds-git-bash-wrapper branch October 10, 2026 14:11
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