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

PATH not respected in hooks #1967

Closed
Lykos153 opened this issue Dec 1, 2023 · 6 comments
Closed

PATH not respected in hooks #1967

Lykos153 opened this issue Dec 1, 2023 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Lykos153
Copy link

Lykos153 commented Dec 1, 2023

Describe the bug
I use devenv and direnv to make some applications available on a per-directory basis by setting the PATH environment variable. I use it especially to provide project specific git hooks. However, when committing with gitui, those applications don't seem to be available.

To Reproduce
Steps to reproduce the behavior:

  1. Create a script somewhere, lets call it my-own-script
  2. Add its parent to the PATH
  3. Create a pre-commit hook that uses my-own-script
  4. Try to commit using gitui
  5. See it fail because it can't find my-own-script

Expected behavior
gitui being able to see applications in the PATH

Context (please complete the following information):

  • NixOS unstable
  • gitui 0.24.3
@Lykos153 Lykos153 added the bug Something isn't working label Dec 1, 2023
@extrawurst
Copy link
Collaborator

that is so weird. we use https://doc.rust-lang.org/std/process/struct.Command.html#method.new and it is supposed to inherit the parents env

@extrawurst
Copy link
Collaborator

#1968 adds a unittest proving that a hook script has access to PATH on all ci platforms

@extrawurst
Copy link
Collaborator

@Lykos153 can you export your environment in your hook for debug purposes like you see it happening in the referenced unittest. I cannot reproduce your problem

@Lykos153
Copy link
Author

Lykos153 commented Dec 5, 2023

Thank you very much for looking into it! And you're right. I realized that with zsh it is indeed working as expected. It only seems to happen using nushell. But what's strange is that it works with git but not with gitui. Whats the difference in how both call the hook? See https://asciinema.org/a/jXDeNAlsYFHs6TSlALE6KGDnr

I will ask the nushell folks, too.

@extrawurst
Copy link
Collaborator

very strange indeed. i am not using nushell. it seems for some reason the gitui process does not see the new version of the env

@extrawurst
Copy link
Collaborator

closing in case we find new evidence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants