Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	Michael Haggerty <mhagger@alum.mit.edu>,
	Jeff King <peff@peff.net>,
	git@vger.kernel.org
Subject: Re: [PATCH] bisect: test merge base if good rev is not an ancestor of bad rev
Date: Sun, 13 Jul 2008 15:14:46 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0807131504130.4816@eeepc-johanness> (raw)
In-Reply-To: <200807130837.40961.chriscool@tuxfamily.org>

Hi,

On Sun, 13 Jul 2008, Christian Couder wrote:

> [PATCH] bisect: check all merge bases instead of only one

It would have been so much nicer to squash the two patches into one, as we 
generally frown upon "let's submit one patch that we know is faulty, and 
then another that fixes it".  That's so CVS/SVN.

> @@ -384,19 +383,21 @@ check_merge_bases() {
>  	_skip="$3"
>  	for _g in $_good; do

I really wonder if we can be blessed with less ugly variable names.  Maybe 
some that do not start with an underscore for no apparent reason, and 
maybe some that are longer than one letter, so that you have a chance to 
understand later what it is supposed to contain.  I.e. something like:

	for good in $good_revisions
	do

(You see that I also broke up the "for" and "do" into two lines, as is 
common practice in the rest of Git's shell code.)

>  		is_merge_base_ok "$_bad" "$_g" && continue
> -		_mb=$(git merge-base $_g $_bad)
> -		if test "$_mb" = "$_g" || is_among "$_mb" "$_good"; then
> -			mark_merge_base_ok "$_bad" "$_g"
> -		elif test "$_mb" = "$_bad"; then
> -			handle_bad_merge_base "$_bad" "$_g"
> -		elif is_among "$_mb" "$_skip"; then
> -			handle_skipped_merge_base "$_bad" "$_g" "_mb"
> -		else
> -			mark_testing_merge_base "$_mb"
> -			checkout "$_mb" "a merge base must be tested"
> -			checkout_done=1
> -			break
> -		fi
> +		for _mb in $(git merge-base --all $_g $_bad); do
> +			if test "$_mb" = "$_g" || is_among "$_mb" "$_good"; then
> +				continue
> +			elif test "$_mb" = "$_bad"; then
> +				handle_bad_merge_base "$_bad" "$_g"
> +			elif is_among "$_mb" "$_skip"; then
> +				handle_skipped_merge_base "$_bad" "$_g" "_mb"
> +			else
> +				mark_testing_merge_base "$_mb"
> +				checkout "$_mb" "a merge base must be tested"
> +				checkout_done=1
> +				return
> +			fi
> +		done
> +		mark_merge_base_ok "$_bad" "$_g"
>  	done
>  }

I really wonder if we cannot do better than that, in terms of code 
complexity.

For example, I wonder if we should special-case the start, and not just 
check everytime if there are unchecked merge bases instead.  If there are, 
check the first.

But that can wait until you come back from your vacation...

Have fun,
Dscho

  reply	other threads:[~2008-07-13 13:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10  3:41 [PATCH] bisect: test merge base if good rev is not an ancestor of bad rev Christian Couder
2008-07-10 10:04 ` Johannes Schindelin
2008-07-10 19:26   ` Christian Couder
2008-07-10 20:02     ` Junio C Hamano
2008-07-10 20:13       ` Junio C Hamano
2008-07-10 22:36       ` Christian Couder
2008-07-10 22:38         ` Johannes Schindelin
2008-07-10 23:21           ` Christian Couder
2008-07-10 23:24           ` Junio C Hamano
2008-07-10 23:45             ` Christian Couder
2008-07-10 23:50               ` Junio C Hamano
2008-07-10 23:59             ` Johannes Schindelin
2008-07-11  6:51               ` Junio C Hamano
2008-07-11 11:21                 ` Johannes Schindelin
2008-07-10 23:10         ` Junio C Hamano
2008-07-13  6:37         ` Christian Couder
2008-07-13 13:14           ` Johannes Schindelin [this message]
2008-07-22  6:15             ` Christian Couder

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=alpine.DEB.1.00.0807131504130.4816@eeepc-johanness \
    --to=johannes.schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    --cc=peff@peff.net \
    /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