From a2cc75bb1c76f6f7797dcedf007d234e44472c03 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Mon, 29 Apr 2019 13:17:30 -0700 Subject: [PATCH] Fix the git diff-image command when run from a subdirectory of the git root. --- README.md | 2 +- install.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2782ade..f132efb 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ It will tell you what it's done, so it should look something like this: + echo '*.jpeg diff=image' >>'/Users/yourname/.gitattributes' + echo '*.jpg diff=image' >>'/Users/yourname/.gitattributes' + echo '*.png diff=image' >>'/Users/yourname/.gitattributes' -+ git config --global alias.diff-image '!f() { GIT_DIFF_IMAGE_ENABLED=1 git diff "$@"; }; f' ++ git config --global alias.diff-image '!f() { cd -- "${GIT_PREFIX:-.}"; GIT_DIFF_IMAGE_ENABLED=1 git diff "$@"; }; f' + git config --global diff.image.command '~/git-diff-image/git_diff_image' ``` diff --git a/install.sh b/install.sh index a9bd69d..3fb7f03 100755 --- a/install.sh +++ b/install.sh @@ -69,8 +69,8 @@ addattr jpeg addattr jpg addattr png -echo '+ git config --global alias.diff-image '"'"'!f() { GIT_DIFF_IMAGE_ENABLED=1 git diff "$@"; }; f'"'" -git config --global alias.diff-image '!f() { GIT_DIFF_IMAGE_ENABLED=1 git diff "$@"; }; f' +echo '+ git config --global alias.diff-image '"'"'!f() { cd -- "${GIT_PREFIX:-.}"; GIT_DIFF_IMAGE_ENABLED=1 git diff "$@"; }; f'"'" +git config --global alias.diff-image '!f() { cd -- "${GIT_PREFIX:-.}"; GIT_DIFF_IMAGE_ENABLED=1 git diff "$@"; }; f' echo "+ git config --global diff.image.command '$thisdir_tilde/git_diff_image'" git config --global diff.image.command "$thisdir_tilde/git_diff_image"