From c349207775ae074b655c2885b0bec4a90c26d0fb Mon Sep 17 00:00:00 2001 From: "George V. Reilly" Date: Fri, 31 Dec 2010 11:10:09 -0800 Subject: [PATCH] Make git-diffall run from a subdirectory. Work around breakage in msysGit's implementation of `git rev-parse --show-toplevel` which returns "c:/stuff" instead of "/c/stuff". --- git-diffall | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/git-diffall b/git-diffall index cf45e22..e629dfa 100755 --- a/git-diffall +++ b/git-diffall @@ -12,6 +12,7 @@ commit SHA1 of a commit path Limit the diff to the specified paths ' +SUBDIRECTORY_OK=1 . "$(git --exec-path)/git-sh-setup" if [ -z $(git config --get diff.tool) ]; then @@ -20,7 +21,13 @@ if [ -z $(git config --get diff.tool) ]; then fi start_dir=$(pwd) -cd_to_toplevel # needed to access tar utility + +# needed to access tar utility +cdup=$(git rev-parse --show-cdup) && +cd "$cdup" || { + echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree" + exit 1 +} # mktemp is not available on all platforms (missing from msysgit) # Use a hard-coded tmp dir if it is not available