rycus86 / githooks

Githooks: per-repo and global Git hooks with version control
MIT License
380 stars 19 forks source link

Faster repository hooks :purple_heart: #151

Closed gabyx closed 3 years ago

gabyx commented 3 years ago

A cherry-pick from currenty go-refactoring.

Makes these hooks way faster. I more and more god fed up that it takes too long ;-) Tested them, works. Thx for merging.

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 912


Totals Coverage Status
Change from base Build 907: 0.0%
Covered Lines: 2371
Relevant Lines: 2955

💛 - Coveralls
rycus86 commented 3 years ago

Can you give some more details on why is this needed? We already have STAGED_FILES set of I remember correctly, so we could just use that in the existing hooks, instead of the whole assert thing from a separate script. Do you need that because you don't have the hooks locally when on the Go branch?

gabyx commented 3 years ago

No, sometimes, you want to execute a pre-commit hook single without invoking git. This ensures that it works...

gabyx commented 3 years ago

Also I added a fix, such that git commit --fixup works

rycus86 commented 3 years ago

No, sometimes, you want to execute a pre-commit hook single without invoking git. This ensures that it works...

OK, that makes sense. I'd have perhaps done it with a special wrapper to do the extra work of setting the staged files variable for you, but this works too I guess, just a bit more boilerplate duplicated.

$ sh bin/run-manually.sh .githooks/pre-commit/no-todo