git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Anders Kaseorg <andersk@mit.edu>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH v2] bisect reset: Allow resetting to any commit, not just a branch
Date: Tue, 13 Oct 2009 22:06:18 +0200	[thread overview]
Message-ID: <200910132206.18460.chriscool@tuxfamily.org> (raw)
In-Reply-To: <alpine.DEB.2.00.0910131116300.5105@dr-wily.mit.edu>

On Tuesday 13 October 2009, Anders Kaseorg wrote:
> @@ -311,8 +311,7 @@ bisect_reset() {
>  	}
>  	case "$#" in
>  	0) branch=$(cat "$GIT_DIR/BISECT_START") ;;
> -	1) git show-ref --verify --quiet -- "refs/heads/$1" ||
> -	       die "$1 does not seem to be a valid branch"
> +	1) git rev-parse --verify "$1^{commit}" || exit
>  	   branch="$1" ;;
>  	*)
>  	    usage ;;

I agree with the purpose of the patch but I think something like the 
following would be better:

@@ -311,8 +311,8 @@ bisect_reset() {
        }
        case "$#" in
        0) branch=$(cat "$GIT_DIR/BISECT_START") ;;
-       1) git show-ref --verify --quiet -- "refs/heads/$1" ||
-              die "$1 does not seem to be a valid branch"
+       1) git rev-parse --quiet --verify "$1^{commit}" > /dev/null ||
+               die "'$1' does not seem to point to a valid commit"
           branch="$1" ;;
        *)
            usage ;;

It would give a better error message when "git rev-parse" fails instead of:

fatal: Needed a single revision

and it would not print the SHA1 from "$1^{commit}" when "git rev-parse" 
succeeds.

Best regards,
Christian.

  reply	other threads:[~2009-10-13 20:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-12 16:38 [PATCH] bisect reset: Allow resetting to any commit, not just a branch Anders Kaseorg
2009-10-12 21:06 ` Junio C Hamano
2009-10-12 21:31   ` Anders Kaseorg
2009-10-12 23:41     ` Junio C Hamano
2009-10-13  6:45       ` Johannes Sixt
2009-10-13  7:21         ` Junio C Hamano
2009-10-13  7:03       ` Anders Kaseorg
2009-10-13 15:22       ` [PATCH v2] " Anders Kaseorg
2009-10-13 20:06         ` Christian Couder [this message]
2009-10-13 20:09           ` Anders Kaseorg
2009-10-13 20:30             ` Christian Couder
2009-10-13 21:02           ` [PATCH v3] " Anders Kaseorg
2009-10-14  9:13             ` Junio C Hamano
2009-10-13  6:39   ` [PATCH] " Johannes Sixt
2009-10-13  7:01     ` Junio C Hamano
2009-10-13  7:45       ` Johannes Sixt
2009-10-13  8:33         ` Junio C Hamano
2009-10-13 14:29           ` Anders Kaseorg

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=200910132206.18460.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=andersk@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).