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

LeftHook commit-msg hooks spawn visible shells before executing #4982

Closed
icorbrey opened this issue Sep 26, 2024 · 4 comments · Fixed by #4999
Closed

LeftHook commit-msg hooks spawn visible shells before executing #4982

icorbrey opened this issue Sep 26, 2024 · 4 comments · Fixed by #4999
Labels
bug Something isn't working 🦀gitoxide🦀 `gitoxide` might help here help wanted We would love you to get involved. os:windows The Windows platform

Comments

@icorbrey
Copy link
Contributor

Version

0.12.26

Operating System

Windows

Distribution Method

msi (Windows)

Describe the issue

I have a Lefthook commit-msg hook that ensures my commit messages are correct semantic commit messages, and it works correctly. However, when run through GitButler it spawns visible shell processes (seemingly while trying to find the system's Lefthook executable since this can be run on many different platforms). This doesn't happen when I commit via the command line or in VSCode.

How to reproduce

  1. Install a commit-msg hook with Lefthook.
  2. Make a change to a file.
  3. Commit the changes.

Expected behavior

No extra windows should appear while waiting for the commit-msg hook to finish.

Relevant log output

No response

@icorbrey icorbrey added the bug Something isn't working label Sep 26, 2024
@Byron Byron added os:windows The Windows platform 🦀gitoxide🦀 `gitoxide` might help here help wanted We would love you to get involved. labels Sep 27, 2024
@Byron
Copy link
Collaborator

Byron commented Sep 27, 2024

Thanks a lot for reporting!

I think the culprit is in the git2-hooks crate which runs a bash like this. This invocation lacks the usual NO_WINDOW flag to suppress the terminal window from showing up:

cmd.creation_flags(0x0800_0000); // CREATE_NO_WINDOW

A patch for this would have to be contributed upstream, and the only reason I didn't do this right away was that validating it would take quite a while for me. However, in theory, adding the above to the command should fix the issue right away.

@icorbrey
Copy link
Contributor Author

No problem! I'll see if I can get a fix in sometime today

@icorbrey
Copy link
Contributor Author

@Byron I've fixed the functionality upstream (see: extrawurst/gitui#2371), hopefully it doesn't take forever for these changes to be merged in and we can see the benefits in the release build!

@icorbrey
Copy link
Contributor Author

Looks like [email protected] has been released. Should I make a PR to bump the version up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🦀gitoxide🦀 `gitoxide` might help here help wanted We would love you to get involved. os:windows The Windows platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants