From 0eae60aa97eb6ba7d1e311719478e9607df64f6d Mon Sep 17 00:00:00 2001 From: Joe Wallwork Date: Mon, 9 Dec 2024 13:21:42 +0000 Subject: [PATCH] Fix minor error in pre-commit --- .pre-commit | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit b/.pre-commit index 55bdc4b1f..3f2f5dd6d 100644 --- a/.pre-commit +++ b/.pre-commit @@ -3,7 +3,7 @@ # An example pre-commit file for nextSIM-DG development BEFORE=$(mktemp) -git diff > ${BEFORE} +git diff >${BEFORE} for FILE in $(git diff --cached --name-only | grep -iE '\.(cpp|cc|h|hpp)$'); do # Apply clang-format for linting @@ -17,8 +17,8 @@ done # Abort commit if formatting was applied AFTER=$(mktemp) -git diff > ${AFTER} -if [ "$(diff nextsim_precommit_before.patch nextsim_precommit_after.patch)" ]; then +git diff >${AFTER} +if [ "$(diff ${BEFORE} ${AFTER})" ]; then echo "Aborting git commit because the pre-commit hook made changes." rm ${BEFORE} ${AFTER} exit 1