From a3cf49de01575a7c3bca4b8897558846d551556a Mon Sep 17 00:00:00 2001 From: Chandler Swift Date: Sat, 3 Aug 2024 23:28:27 -0500 Subject: [PATCH] Add TODO check to pre-commit-hook --- oscar/git-pre-commit-hook | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/oscar/git-pre-commit-hook b/oscar/git-pre-commit-hook index ae916bf..d52ec00 100755 --- a/oscar/git-pre-commit-hook +++ b/oscar/git-pre-commit-hook @@ -6,6 +6,14 @@ else against=$(git hash-object -t tree /dev/null) fi +# https://stackoverflow.com/a/7292992 +. git-sh-setup # for die +if git-diff-index -p -M --cached $against -- \ +| grep '^+' \ +| grep TODO; then + die Blocking commit because string TODO detected in patch +fi + # If you want to allow non-ASCII filenames set this variable to true. allownonascii=$(git config --type=bool hooks.allownonascii)