Closed tdesveaux closed 2 months ago
When running a git command that invoke a hook handled by lefthook, the command will fail on the mkdir call here
mkdir
This fails here, but all git calls should have the same issue.
1.6.12 e87cc77f7d91893d701ae6dece10c65c32974555
run GIT_TRACE=1 git push
GIT_TRACE=1 git push
Lefthook should not break when GIT_TRACE=1 is set.
GIT_TRACE=1
Lefthook does not correctly handle Stderr on git commands.
I believe the issue is that git rev-parse --git-path info called above captures Stderr in the same buffer that Stdout is expected.
git rev-parse --git-path info
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
Thank you for creating this issue. I am preparing a refactoring that will cover this case: stderr will be redirected to OS' stderr directly.
:wrench: Summary
When running a git command that invoke a hook handled by lefthook, the command will fail on the
mkdir
call hereThis 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