Skip to content

Commit

Permalink
only run Ginkgo focus detection in staged files in pre-commit hook
Browse files Browse the repository at this point in the history
If a change is not staged (and therefore won't be committed), we don't care.
  • Loading branch information
marten-seemann committed Mar 19, 2021
1 parent 522cad0 commit 64f015f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
errored=false
for f in $(git diff --cached --name-only); do
if [[ $f != *_test.go ]]; then continue; fi
output=$(grep -n -e "FIt(" -e "FContext(" -e "FDescribe(" "$f")
output=$(git show :"$f" | grep -n -e "FIt(" -e "FContext(" -e "FDescribe(")
if [ $? -eq 0 ]; then
echo "$f contains a focussed test:"
echo "$output"
Expand Down

0 comments on commit 64f015f

Please sign in to comment.