From b7cce75c3fc80a5620135fbdde3e80707d3c8ab8 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Wed, 10 Apr 2019 18:21:00 -0700 Subject: [PATCH] Don't perform the first call to compare if we've seen a difference in the EXIF info. This means that we won't run the (potentially expensive) first compare if we have seen a metadata change, in particular a file size change. We already know that there's a difference. --- diff-image | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/diff-image b/diff-image index 1c1e595..b3375f3 100755 --- a/diff-image +++ b/diff-image @@ -132,11 +132,16 @@ diff_clean_names() } +exifdiff= if which exiftool > /dev/null then d1="$(exif "$f1")" d2="$(exif "$f2")" diff_clean_names "$d1" "$d2" + set +e + diff -q "$d1" "$d2" >/dev/null + exifdiff=$? + set -e else diff_clean_names "$f1" "$f2" fi @@ -154,7 +159,7 @@ then exit 1 fi -if compare "$f1" "$f2" /dev/null +if [[ $exifdiff = 0 ]] && compare "$f1" "$f2" /dev/null then exit 0 fi