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

fix: your current branch does not have any commits yet #27 #34

Closed acesyde closed 2 years ago

acesyde commented 2 years ago

Description

Fixed first commit when current git repository contains no commits

Fixes # (issue)

Type of change

Checklist

alirezanet commented 2 years ago

Hi, thanks! I think this way we lose task action on the first commit which is not ideal. should be a better way to handle this. 🤔 we need to prevent the exception also do the task action on the first commit.

acesyde commented 2 years ago

You're right i will check that ;)

acesyde commented 2 years ago

@alirezanet I checked how pre-commit fetches staged files

They use this command

https://github.com/pre-commit/pre-commit/blob/e0e536b54e1d7abcea477ad74e2b738fec0b35b0/pre_commit/git.py#L127 git diff --staged --name-only --no-ext-diff --diff-filter=ACMRTUXB

And it works fine with that

alirezanet commented 2 years ago

Look's fine if it solves the problem. I need a little bit of time to manually test this. thanks