From 0de38647f12520860a47bf4f4cd66b882ff1ccb8 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Wed, 21 Dec 2022 11:58:10 -0800 Subject: [PATCH] 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. --- git_diff_image | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/git_diff_image b/git_diff_image index 5d5ea0b..382a11e 100755 --- a/git_diff_image +++ b/git_diff_image @@ -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"