Skip to content

Commit

Permalink
git-reset: complain and exit upon seeing an unknown parameter.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jul 6, 2006
1 parent bc483d0 commit ac83aa2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion git-reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ac83aa2

Please sign in to comment.