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

error in dotnet husky install #89

Closed EngRajabi closed 10 months ago

EngRajabi commented 10 months ago

I don't have this problem in version 0.5.4. That's why I use the old version

Version

0.6.0

Details

add command in root sln directory

dotnet husky install

error

failed to execute command 'git'
Could not determine git configuration

Steps to reproduce

alirezanet commented 10 months ago

Hi @EngRajabi,

I've tested it and it looks fine! at least with the steps you mentioned to reproduce the error:

what did I miss? try to run the command with -v so it might give you more information. dotnet husky install -v

EngRajabi commented 10 months ago

For testing, I did this process with version 0.5.4 and everything was fine. But with version 0.6.0 I still have problem. Indra.sln file exists in root.

D:\Indra Project>dotnet husky install -v
Checking git path and working directory
failed to execute command 'git'
Command execution failed, see the inner exception for details.

Standard error:
fatal: cannot change to 'D:\Indra': No such file or directory
Could not determine git configuration

image

Tychus commented 10 months ago

I can take a look. from reading the issue i suspect it's around the running git in a specific directory.

Tychus commented 10 months ago

Ah wait a second your path has space in it. That might be the issue i think.

D:\Indra Project>dotnet husky install -v

error says fatal: cannot change to 'D:\Indra': No such file or directory

Yup, confirmed. Issue happens only when the directory name has space.

image

alirezanet commented 10 months ago

Good catch, I think this problem is related to these methods where we're sending the path to the git command: https://github.com/alirezanet/Husky.Net/blob/6a64ebed307797f37c8e36c1c4624f7875a88eb5/src/Husky/Services/Git.cs#L111-L115

https://github.com/alirezanet/Husky.Net/blob/6a64ebed307797f37c8e36c1c4624f7875a88eb5/src/Husky/Services/Git.cs#L91-L95

the ExecBufferedAsync should receive a list of arguments instead of raw string

Tychus commented 10 months ago

working on a fix for those two methods

alirezanet commented 10 months ago

Hi @EngRajabi, I released a new version and this should be fixed in v0.6.1, please let me know if it works for you.

EngRajabi commented 10 months ago

Yes, the problem is solved. Thankful