From: Junio C Hamano <junkio@cox.net>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: git@vger.kernel.org
Subject: Re: git reset --hard include/linux/config.h
Date: Wed, 05 Jul 2006 19:45:59 -0700 [thread overview]
Message-ID: <7vhd1va1so.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20060705165801.GA11822@mars.ravnborg.org> (Sam Ravnborg's message of "Wed, 5 Jul 2006 18:58:01 +0200")
Sam Ravnborg <sam@ravnborg.org> writes:
> Now git reset is maybe supposed to work on commit level only, but it
> would have been nice if it erroroed out when it saw an argument that
> it did not know about. In this case I assume git reset used
> "include/linux/config.h" as <commitish>.
There is an attempt to have that check, but obviously it is
busted. Thanks for noticing.
Maybe something like this is needed instead.
-- >8 --
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>
---
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
prev parent reply other threads:[~2006-07-06 2:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-05 16:58 git reset --hard include/linux/config.h Sam Ravnborg
2006-07-05 17:05 ` Alex Riesen
2006-07-05 17:14 ` Sam Ravnborg
2006-07-05 17:29 ` Alex Riesen
2006-07-06 2:45 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vhd1va1so.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.