Skip to content

Commit

Permalink
Fix minor error in pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jwallwork23 committed Dec 9, 2024
1 parent cd35f66 commit 0eae60a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0eae60a

Please sign in to comment.