X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=git-sh-setup-script;h=9ed5e851523a47aa3633494072e6295aa93adb01;hb=6e7722e6f88c049f43a1c00c45c502542d1a5752;hp=5bf471f78150962a131ebc5f1b2e92e57cda70c9;hpb=379955c696a417f0fb6118f2fd91dbffd2816ad1;p=git.git diff --git a/git-sh-setup-script b/git-sh-setup-script index 5bf471f7..9ed5e851 100755 --- a/git-sh-setup-script +++ b/git-sh-setup-script @@ -11,7 +11,17 @@ die() { exit 1 } -[ -d "$GIT_DIR" ] && +check_clean_tree() { + dirty1_=`git-update-cache -q --refresh` && { + dirty2_=`git-diff-cache --name-only --cached HEAD` + case "$dirty2_" in '') : ;; *) (exit 1) ;; esac + } || { + echo >&2 "$dirty1_" + echo "$dirty2_" | sed >&2 -e 's/^/modified: /' + (exit 1) + } +} + +[ -h "$GIT_DIR/HEAD" ] && [ -d "$GIT_DIR/refs" ] && -[ -d "$GIT_OBJECT_DIRECTORY" ] && [ -d "$GIT_OBJECT_DIRECTORY/00" ]