aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-revert.sh5
-rwxr-xr-xgit-sh-setup.sh11
2 files changed, 4 insertions, 12 deletions
diff --git a/git-revert.sh b/git-revert.sh
index 722c4f755..dfd914cf5 100755
--- a/git-revert.sh
+++ b/git-revert.sh
@@ -56,9 +56,12 @@ t)
die "Your index file is unmerged."
;;
*)
- check_clean_tree || die "Cannot run $me from a dirty tree."
head=$(git-rev-parse --verify HEAD) ||
die "You do not have a valid HEAD"
+ files=$(git-diff-index --cached --name-only $head) || exit
+ if [ "$files" ]; then
+ die "Dirty index: cannot $me (dirty: $files)"
+ fi
;;
esac
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index d5bfa62de..55db79584 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -17,17 +17,6 @@ die() {
exit 1
}
-check_clean_tree() {
- dirty1_=`git-update-index -q --refresh` && {
- dirty2_=`git-diff-index --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" ]