From 7ef0d7bbf73383bd1ccf2c8d4380f0c1ff06128f Mon Sep 17 00:00:00 2001 From: Raine Revere Date: Mon, 18 Dec 2023 01:27:33 +0000 Subject: [PATCH] post-commit: Remove git commit from notification title. --- .hooks/post-commit | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.hooks/post-commit b/.hooks/post-commit index 05dd85fc..9d784771 100755 --- a/.hooks/post-commit +++ b/.hooks/post-commit @@ -11,18 +11,14 @@ strip() { notify() { # if osascript is not supported, do nothing if [ -f /usr/bin/osascript ]; then - # get ' ' - COMMIT_INFO=$(git log --oneline -n 1 --format="%h %s") - # read back in the lint errors - # TODO: update for each tye of error ERRORS=$(cat "$LINT_LOG" | sed 1,4d) # Trigger apple- or OSA-script on supported platforms - /usr/bin/osascript -e "display notification \"$ERRORS\" with title \"ncu: $COMMIT_INFO: $*\"" + /usr/bin/osascript -e "display notification \"$ERRORS\" with title \"$*\"" fi - # always clean up the lint output, and do not clag-up TMPDIR + # clean up rm "$LINT_LOG" } @@ -35,9 +31,7 @@ if [ -z "$branch" ]; then exit 0 fi -# Lint asynchrously, not blocking the terminal and piping all output to a file. -# IFF lint fails trigger a pop-up (on supported platforms) with at least the -# first error shown. -# We pipe output so that the terminal (tmux, vim, emacs etc.) isn't borked by -# stray output. +# Lint in the background, not blocking the terminal and piping all output to a file. +# If the lint fails, trigger a notification (on supported platforms) with at least the first error shown. +# We pipe output so that the terminal (tmux, vim, emacs etc.) isn't borked by stray output. npm run lint:src | strip &>"$LINT_LOG" || notify "Lint Error" &