the home site for me: also iteration 3 or 4 of my site
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: update git hook to be faster

+26 -11
+26 -11
hooks/pre-commit
··· 35 35 exit 1 36 36 fi 37 37 38 - # Second pass: process images 38 + # Second pass: process images in parallel 39 + pids=() 40 + tmpdir=$(mktemp -d) 41 + 39 42 while read -r file; do 40 43 case "$file" in 41 44 *.jpg|*.jpeg|*.png|*.gif|*.tiff|*.bmp) 42 - # Store output of exiftool command 43 - cleared_data=$(exiftool -all= --icc_profile:all -tagsfromfile @ -orientation -overwrite_original "$file") 44 - if [ $? -ne 0 ]; then 45 - echo "Error: exiftool failed to process $file" >&2 46 - exit 1 47 - fi 48 - echo "Cleared EXIF data for $file:" >&2 49 - echo "$cleared_data" >&2 50 - git add "$file" 45 + ( 46 + cleared_data=$(exiftool -all= --icc_profile:all -tagsfromfile @ -orientation -overwrite_original "$file" 2>&1) 47 + if [ $? -ne 0 ]; then 48 + echo "Error: exiftool failed to process $file" >&2 49 + exit 1 50 + fi 51 + echo "Cleared EXIF data for $file:" >&2 52 + echo "$cleared_data" >&2 53 + echo "$file" >> "$tmpdir/processed" 54 + ) & 55 + pids+=($!) 51 56 ;; 52 57 *) 53 58 ;; 54 59 esac 55 60 done < <(git diff --cached --name-only --diff-filter=ACMR) 56 61 57 - exit 0 62 + failed=0 63 + for pid in "${pids[@]}"; do 64 + wait "$pid" || failed=1 65 + done 66 + 67 + if [ -f "$tmpdir/processed" ]; then 68 + git add -- $(cat "$tmpdir/processed") 69 + fi 70 + rm -rf "$tmpdir" 71 + 72 + exit $failed