Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX-5101: Git Hooks Incompatible with zsh #4496

Open
mikemadison13 opened this issue Mar 28, 2022 · 6 comments
Open

DX-5101: Git Hooks Incompatible with zsh #4496

mikemadison13 opened this issue Mar 28, 2022 · 6 comments
Labels
Bug Something isn't working

Comments

@mikemadison13
Copy link
Contributor

Describe the bug
The default BLT git hooks (in https://github.com/acquia/blt/tree/main/scripts/git-hooks) explicitly define bash as the scripting engine, which causes them to fail on zsh terminals.

To Reproduce
Steps to reproduce the behavior, ideally starting from a fresh install of BLT:

  1. run blt setup to install the hooks
  2. attempt a git commit with the stock git hooks in place (and note failure)

I think that ideally BLT would provide a shell variable that lets us differentiate between bash or zsh hooks and make the path to the hooks dynamic.

@mikemadison13 mikemadison13 added the Bug Something isn't working label Mar 28, 2022
@github-actions github-actions bot changed the title Git Hooks Incompatible with zsh DX-5101: Git Hooks Incompatible with zsh Mar 28, 2022
mikemadison13 pushed a commit to mikemadison13/blt that referenced this issue Mar 28, 2022
mikemadison13 pushed a commit to mikemadison13/blt that referenced this issue Mar 28, 2022
@danepowell
Copy link
Contributor

@mikemadison13 it shouldn't matter what your default shell is, as long as Bash is installed on your machine. Are you saying that Bash is no longer installed at all on M1 Macs? That would be a massive breaking change, considering half the shell scripts in the world require Bash.

@mikemadison13
Copy link
Contributor Author

i'm pretty sure bash is on the machine, but given that my new M1 came pre-configured with ZSH all of the BLT git hooks were failing. i'm open to other ideas, but i think "having" bash and "using" bash could be the disconnect here.

@danepowell
Copy link
Contributor

I use ZSH on my non-M1 Mac and have never had an issue with the shell scripts. The whole point of the shebang is to specify the interpreter, it's often not even a shell but NodeJS or PHP. Obviously you don't use PHP as your shell, but PHP scripts defined this way should still run fine 😄

Can you be more specific about the error you're seeing?

@mikemadison13
Copy link
Contributor Author

I'll see if I can reproduce, they seem to be working today 🤦

@bmartinez287
Copy link

bmartinez287 commented Jun 14, 2022

So githooks started failing for me recently. Specially the precommit "Validating commit message syntax".
I'm not sure yet how related this might be to any changes done here. But I am using ZSH on my mac on Monterrey version 12.3.1. It seems like the issue is something that was introduced in BLT 13.4 because it works fine on 13.3. What changed that could be stepping on git precommit hooks?

@AJWAverill
Copy link

BLT Version 13.7.4.0

I have the githook issue also. New Macbook running Sonoma 14.4. Existing project using ddev. Working fine on older machine. I can get the pre-push hook working by changing

"${ROOT_DIR}"/vendor/bin/blt internal:git-hook:execute:pre-push

to

ddev exec blt internal:git-hook:execute:pre-push

In pre commit a similar change has no effect. I still receive the error below.

Untracked files are present, this may impact the validity of pre-commit checks.
env: php: No such file or directory

There are no untracked files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants