Skip to content

Commit 14d726e

Browse files
author
Alan Fineberg
committed
Clarify the fixup instructions for the precommit hook.
1 parent 6d2bc78 commit 14d726e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

format-objc-hook

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,24 @@ objc_files=$(objc_files_to_format "$1")
1919
function format_objc() {
2020
success=0
2121
for file in $objc_files; do
22-
difference=$("$DIR"/format-objc-file-dry-run.sh "$file" | diff "$file" - | wc -l)
22+
difference=$("$DIR"/format-objc-file-dry-run.sh "$file" | diff "$file" - | wc -l)
2323

2424
if [ $difference -gt 0 ]; then
25+
if [ $success -eq 0 ]; then
26+
echo -e "🚸 Format and stage individual files:"
27+
fi
2528
# This is what the dev can run to fixup an individual file
2629
echo "\"$DIR\"/format-objc-file.sh '$file' && git add '$file';"
2730
success=1
2831
fi
2932
done
33+
if [ $success -gt 0 ]; then
34+
echo -e "\n🚀 Format and stage all affected files:\n\t \"$DIR\"/format-objc-files.sh -s"
35+
fi
3036
return $success
3137
}
3238

3339
success=0
34-
format_objc || (echo -e "🔴 There were formatting issues with this commit, fix by running the👆 above👆 commands. \n\tYou can also run: \"$DIR\"/format-objc-files.sh\n💔 Commit anyway and skip this check by running git commit --no-verify" && success=1)
40+
format_objc || (echo -e "\n🔴 There were formatting issues with this commit, run the👆 above👆 command to fix.\n💔 Commit anyway and skip this check by running git commit --no-verify" && success=1)
3541

3642
exit $success

0 commit comments

Comments
 (0)