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 fails git command when run with GIT_TRACE=1 #730

Closed
tdesveaux opened this issue May 27, 2024 · 1 comment · Fixed by #735
Closed

lefthook fails git command when run with GIT_TRACE=1 #730

tdesveaux opened this issue May 27, 2024 · 1 comment · Fixed by #735
Labels
bug Something isn't working

Comments

@tdesveaux
Copy link
Contributor

🔧 Summary

When running a git command that invoke a hook handled by lefthook, the command will fail on the mkdir call here

This fails here, but all git calls should have the same issue.

Lefthook version

1.6.12 e87cc77f7d91893d701ae6dece10c65c32974555

Steps to reproduce

run GIT_TRACE=1 git push

Expected results

Lefthook should not break when GIT_TRACE=1 is set.

Actual results

Lefthook does not correctly handle Stderr on git commands.

Possible Solution

I believe the issue is that git rev-parse --git-path info called above captures Stderr in the same buffer that Stdout is expected.

Logs / Screenshots

GIT_TRACE=1 LEFTHOOK_VERBOSE=1 git push
...
│ [lefthook] cmd: [git rev-parse --git-path info]
│ [lefthook] dir: 
│ [lefthook] err: <nil>
│ [lefthook] out: 13:45:15.686852 git.c:460               trace: built-in: git rev-parse --git-path info
.git/info                                                                                             
                                                                                                      
Error: mkdir 13:45:15.686852 git.c:460               trace: built-in: git rev-parse --git-path info
.git/info: no such file or directory                                                               
@tdesveaux tdesveaux added the bug Something isn't working label May 27, 2024
@mrexox
Copy link
Member

mrexox commented May 30, 2024

Thank you for creating this issue. I am preparing a refactoring that will cover this case: stderr will be redirected to OS' stderr directly.

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

Successfully merging a pull request may close this issue.

2 participants