alirezanet / Husky.Net

Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
https://alirezanet.github.io/Husky.Net/
MIT License
632 stars 29 forks source link

Issue with hook for commits with paths that contain files with spaces #110

Closed alirezanet closed 1 month ago

alirezanet commented 1 month ago

Discussed in https://github.com/alirezanet/Husky.Net/discussions/107

Originally posted by **wando777** April 22, 2024 Hello, there 👋 If the path to my staged directory contains spaces, when running any task, despite identifying the path with double quotes, I always get the return of `fatal: pathspec ... did not match any files`. Here's my `task-runner.json` ``` { "tasks": [ { "name": "echo staged files", "pathMode": "absolute", "command": "cmd", "group": "pre-commit", "args": [ "/c", "echo", "${staged}" ] } ] } ``` Here's also the output from my console after running `dotnet husky run` ``` [Husky] ? Preparing task 'echo staged files' [Husky] ? Executing task 'echo staged files' ... .editorconfig .config/dotnet-tools.json .husky/pre-commit .husky/task-runner.json "src/Private Assemblies/path-to-my-controller/MyController.cs" fatal: pathspec 'src/Private' did not match any files [Husky] ? Successfully executed in 45m ``` So, even though it executes dotnet-format, the hook doesn't end up with the modified file in the staged area but the hook stops before that. Any idea what's going on?