prepre-commit-msg git hook breaks IDE
See original GitHub issueHi,
While integrating this tool I noticed that my IDE started to misbehave when it performed git operations.
The example in the docs offers the following approach, which assumes /dev/tty is always available:
exec < /dev/tty && git cz --hook # <-- This fails when "not a tty"
The below uses a short-circuit to exit with an exit code of 0 in case tty is not available.
exec < /dev/tty && git cz --hook || true
Using the above solved a case where my IDE got killed during a rebase
But I suspect that anything that interacts with git is susceptible to this pitfall.
Let me know if you agree, and i’ll work on a PR.
P.S:
Found a case in point:
https://stackoverflow.com/questions/55815650/lint-staged-commitizen-configuration-suitable-for-command-line-and-intellij/56555664#56555664
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
git commit failed with git-hook error - Visual Studio Feedback
Client-side hooks seems like a basic git feature that should just work. And I think it worked at one time in Visual Studio...
Read more >Git Hooks - Git SCM
The first four hooks have to do with the committing process. The pre-commit hook is run first, before you even type in a...
Read more >Fixing mac/windows new lines with git pre-commit hook?
For Windows machines use git config --global core.autocrlf true. with this settings git will convert all \r\n line endings to \n before every...
Read more >Pre-commit: Don't git hooked! - Thoughtworks
Git hooks are a feature of git that enable custom scripts to be triggered on certain events during the execution of a git...
Read more >Show the output of the git hook scripts : IDEA-82777 - YouTrack
IDEA-154053 Git pre-push hooks not propagating error messages to IDE ... IDEA-153912 Commit failed with error loses formatting (line breaks and angle ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m still getting this error with Visual Studio Code in my Ubuntu 😕
This is what I’m using to fix that instead of just
exec < /dev/tty && git cz --hook --hook || true
:@eladchen - Thanks, just ran to the same issue!