Open AlexanderOpran opened 4 years ago
I have exactly the same problem when I add to package.json
:
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
If i use npm run commit
at "commit": "git-cz"
, then everything breaks down. In addition to commitizen, I have a Prettier hook installed.
@AlexanderOpran @batyshkaLenin
Yeah. When used with prepare-commit-msg
, it shows me that problem as well. So, I avoided using hooks with commitizen altogether. By the way for what purposes are you using commitizen+hooks (like prepare-commit-msg
)? Is it for a git rebase
scenario?
@s14k51 for commits
Same issue here. Waiting for a fix for this hook :(
I was having the same problem. I installed the ConEmu terminal and solved my problem.
It looks like this is a problem with the inquirer library that commitizen uses for prompting: https://github.com/SBoudrias/Inquirer.js/issues/793
I was having the same problem. I installed the ConEmu terminal and solved my problem.
Didn't work for me unfortunally :(
Same problem...
same problem
nothing?
same problem
nothing? =/
It looks like cz is piping the input to vim instead of passing it and waiting for the output. If things aren't set up properly and you run git cz
and it opens vim, the input behaves in an unusual way.
same problem :/
I'm having the same issue, is there a solution for this? From what I've seen in other Issues, people have been having the same problem for years. I'm afraid to implement it in my project because if someone wants to program through Windows, they will have trouble when committing.
Add this line at the beginning of your husky hook.
if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then exec </dev/tty >/dev/tty 2>&1; fi
Took me a few hours to came up with this solution. Now I get full color and interactivity in Git Bash inside Windows Terminal on Win 11. Bonus: it also improved my lint-staged prettier hook.
@grumd Oh, thanks for you solution, maybe you can explain it for me? I'm bad on bash scripts.
@Krasava872 if sh -c ": >/dev/tty"
checks if /dev/tty
is available, and if it is, it redirects stdin, stdout and stderr to /dev/tty.
Multiplication of stdout (I traced this issue down to the log-update package but I could be wrong). Seems like the package doesn't know what to cut from the output (wrong terminal height or something).
Colors are not showing (I can set a env variable to bypass this but the multiplication bug is still there). Again, I believe this is a windows and dependencies issue. This happens with regular git hooks created manually, not only with husky.
Thanks!