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.
This commit is contained in:
Ewan Mellor
2019-04-10 18:21:00 -07:00
parent fbd9755105
commit b7cce75c3f

View File

@ -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