X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-sh-setup-script;h=9ed5e851523a47aa3633494072e6295aa93adb01;hb=1efdd27f54e42746c23944cfe77e568673b2a0fa;hp=660c524ce86dfdcf818a1e6698ddf135bac28a58;hpb=51cb06c36de67007f3464d864f63d93213fcaf86;p=git.git diff --git a/git-sh-setup-script b/git-sh-setup-script index 660c524c..9ed5e851 100755 --- a/git-sh-setup-script +++ b/git-sh-setup-script @@ -11,7 +11,17 @@ die() { exit 1 } -[ -d "$GIT_DIR" ] && -[ -d "$GIT_DIR/refs" ] -[ -d "$GIT_OBJECT_DIRECTORY" ] && +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/00" ]