You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running dotnet husky add with some command is not line-terminated. Another execution will put the second command together with the first one. The bug only happens for the first invocation.
To Reproduce
Run the following commands in a shell, in a new directory and in the shown sequence:
git init
dotnet new tool-manifest
dotnet tool install Husky
dotnet husky install
dotnet husky add .husky/pre-commit "echo 'Husky is awesome!'"
dotnet husky add .husky/pre-commit "echo 'Husky is awesome!'"
git commit --allow-empty -m "Keep calm and commit"
The final git commit will print the following:
Husky is awesome!echo Husky is awesome!
[master (root-commit) 656c076] Keep calm and commit
Note that what gets printed from the hook is the single line Husky is awesome!echo Husky is awesome!.
Expected behavior
I would have expected the following output:
Husky is awesome!
Husky is awesome!
[master (root-commit) 656c076] Keep calm and commit
That is Husky is awesome! printed on two separate lines.
Additional information
It's clear why this is happening when one inspects the content of .husky/pre-commit:
#!/bin/sh."$(dirname "$0")/_/husky.sh"## husky task runner examples -------------------## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'## run all tasks#husky run### run all tasks with group: 'group-name'#husky run --group group-name## run task with name: 'task-name'#husky run --name task-name## or put your custom commands -------------------#echo 'Husky.Net is awesome!'echo'Husky is awesome!'echo 'Husky is awesome!'
The first command was not line-terminated.
This does not happen for subsequent runs of husky add. For example, following-up with the commands:
dotnet husky add .husky/pre-commit "echo 'Husky is awesome!'"
git commit --allow-empty -m "Keep calm and commit"
prints:
Husky is awesome!echo Husky is awesome!
Husky is awesome!
[master 51f1c2b] Keep calm and commit
The third addition correctly printed on its own line.
The text was updated successfully, but these errors were encountered:
Running
dotnet husky add
with some command is not line-terminated. Another execution will put the second command together with the first one. The bug only happens for the first invocation.To Reproduce
Run the following commands in a shell, in a new directory and in the shown sequence:
The final
git commit
will print the following:Note that what gets printed from the hook is the single line
Husky is awesome!echo Husky is awesome!
.Expected behavior
I would have expected the following output:
That is
Husky is awesome!
printed on two separate lines.Additional information
It's clear why this is happening when one inspects the content of
.husky/pre-commit
:The first command was not line-terminated.
This does not happen for subsequent runs of
husky add
. For example, following-up with the commands:prints:
The third addition correctly printed on its own line.
The text was updated successfully, but these errors were encountered: