Hook up the -o flag from Hannes Achleitner (changeset 25364cc).

This adds handling for GIT_DIFF_IMAGE_OUTPUT_DIR as an environment variable,
and creates a filename for each comparison to pass through the -o flag.
This commit is contained in:
Ewan Mellor
2022-12-21 11:58:10 -08:00
parent 281ea97e2c
commit 0de38647f1

View File

@ -63,5 +63,19 @@ then
e_flag='-e'
fi
o_flag=''
if [ -n "${GIT_DIFF_IMAGE_OUTPUT_DIR-}" ]
then
mkdir -p "$GIT_DIFF_IMAGE_OUTPUT_DIR"
destfile=''
if [ "$name1" -ne '/dev/null' ]
then
destfile=$(basename "$name1")
else
destfile=$(basename "$name2")
fi
o_flag="-o $GIT_DIFF_IMAGE_OUTPUT_DIR/$destfile"
fi
exec "$thisdir/diff-image" $e_flag -n "$name1" -N "$name2" "$f1" "$f2"
exec "$thisdir/diff-image" $e_flag $o_flag -n "$name1" -N "$name2" "$f1" "$f2"