« first day (5005 days earlier)      last day (10 days later) » 

10:32 AM
Please, vote to close it as a dup
 
11:31 AM
@nbro Use the tag here for that sort of request
 
 
3 hours later…
2:23 PM
I need a tool that slaps me with a "you fool, you can't commit a bugfix without implementing a test case for the bug" whenever I try to make a commit that contains the word "fix" and no file in the tests directory changed
 
I generally just have coverage enforcing that, well, coverage may not be lowered by PRs.
 
 
4 hours later…
6:32 PM
 
Oh wow, thanks! That's pretty neat
 
haha
You're welcome
 
 
2 hours later…
9:46 PM
@Aran-Fey have you tried that? Because as far as I know the pre-commit runs before you get a chance to phrase the commit message. You'd want the commit-msg hook, and when that runs you get the commit message in $1. And if you want to subvert either of those hooks due to false positives, you can do git commit --no-verify, same goes for merges where the message is auto-generated.
I could be wrong but the domain starts with chatgpt so...
 
10:00 PM
And it would probably be more robust (read: paranoid) to work with something like git diff --cached --name-only --diff-filter=d -z | grep -qz '^tests/' assuming git bash supports all these. --diff-filter=d excludes deleted files (so that just deleting a test doesn't skip the hook), the -z flags ensure that you can handle zalgo in paths, and there's really no reason to catch a variable and echo it back if you can just pipe. Oh, and I'd definitely anchor the regex at the start.
But I didn't test any of this.
Odds are you can also use -v with grep to invert the match and avoid having to negate the result in sh.
 

« first day (5005 days earlier)      last day (10 days later) »