summaryrefslogtreecommitdiff
path: root/git-reset.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-07-06 02:44:03 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-07-06 02:44:03 (GMT)
commitac83aa2e1fffcb4e7560431ddc15b288dc237634 (patch)
tree04260e7de0a88df848b005663a7f5aa38610a6ef /git-reset.sh
parentbc483d04804888c2da64e4c6685c2860a9041122 (diff)
downloadgit-ac83aa2e1fffcb4e7560431ddc15b288dc237634.zip
git-ac83aa2e1fffcb4e7560431ddc15b288dc237634.tar.gz
git-ac83aa2e1fffcb4e7560431ddc15b288dc237634.tar.bz2
git-reset: complain and exit upon seeing an unknown parameter.
The check to use "rev-parse --verify" was defeated by the use of "--default HEAD". "git reset --hard bogus-committish" just defaulted to reset to the HEAD without complaining. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-reset.sh')
-rwxr-xr-xgit-reset.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/git-reset.sh b/git-reset.sh
index 46451d0..5c02240 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -17,7 +17,11 @@ case "$1" in
usage ;;
esac
-rev=$(git-rev-parse --verify --default HEAD "$@") || exit
+case $# in
+0) rev=HEAD ;;
+1) rev=$(git-rev-parse --verify "$1") || exit ;;
+*) usage ;;
+esac
rev=$(git-rev-parse --verify $rev^0) || exit
# We need to remember the set of paths that _could_ be left