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

Use default shell for git-hooks instead of bash #2317

Closed
mtsgrd opened this issue Jul 31, 2024 · 4 comments · Fixed by #2343
Closed

Use default shell for git-hooks instead of bash #2317

mtsgrd opened this issue Jul 31, 2024 · 4 comments · Fixed by #2343
Milestone

Comments

@mtsgrd
Copy link

mtsgrd commented Jul 31, 2024

Would it be possible to run the hooks with the shell specified by $SHELL instead of defaulting to bash here? If I understand correctly, it matters when running from a non-login (e.g. gui application) shell since bash won't inherit desired environment variables.

https://github.com/extrawurst/gitui/blob/4ef633a75a3581936d0da9aade7af8ed7aad98ab/git2-hooks/src/hookspath.rs#L116-L117

@yerke
Copy link
Contributor

yerke commented Aug 1, 2024

zsh is the default shell on macOS these days.

@yerke
Copy link
Contributor

yerke commented Aug 23, 2024

My attempt to fix this issue: #2343

@extrawurst extrawurst added this to the v0.27 milestone Aug 23, 2024
@yerke
Copy link
Contributor

yerke commented Aug 23, 2024

@extrawurst is it possible to make a new release just for git2-hooks? Thanks.

@Joshix-1
Copy link
Contributor

Joshix-1 commented Jan 16, 2025

On *nix it should be possible to execute the git-hooks directly. That's how git does it I think.

it matters when running from a non-login (e.g. gui application) shell

Wouldn't it be better to make sure to run gitui from a login-shell?

Would it be possible to run the hooks with the shell specified by $SHELL instead of defaulting to bash here?

Nothing guarantees that the login shell behaves like sh so it shouldn't be assumed that it does.

#2483 tries to improve the git-hooks behaviour, but it would be bad if it broke existing workflows.
So what are you doing that you think it should read SHELL? If you are using git2-hooks, there could maybe be an option added to specify how to execute the git-hooks. But for gitui reading SHELL and trying to execute hooks with that is for sure the wrong way.

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

Successfully merging a pull request may close this issue.

4 participants