git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Harald Nordgren <haraldnordgren@gmail.com>
Cc: git@vger.kernel.org, tiago@gitlab.com,
	christian.couder@gmail.com, sbeller@google.com
Subject: Re: [PATCH v3] bisect: create 'bisect_flags' parameter in find_bisection()
Date: Wed, 18 Apr 2018 22:31:26 +0200 (DST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1804182228210.4241@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz> (raw)
In-Reply-To: <20180415134925.6203-1-haraldnordgren@gmail.com>

Hi Harald,

On Sun, 15 Apr 2018, Harald Nordgren wrote:

> Make it possible to implement bisecting only on first parents or on
> merge commits by passing flags to find_bisection(), instead of just
> a 'find_all' boolean.
> 
> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>

Very nice. Just two little suggestions:

> diff --git a/bisect.c b/bisect.c
> index a579b50884..19dac7491d 100644
> --- a/bisect.c
> +++ b/bisect.c
> @@ -254,7 +254,7 @@ static struct commit_list *best_bisection_sorted(struct commit_list *list, int n
>   */
>  static struct commit_list *do_find_bisection(struct commit_list *list,
>  					     int nr, int *weights,
> -					     int find_all)
> +					     unsigned int bisect_flags)

For flags, we frequently seem to use the type `unsigned` (which is the
same as `unsigned int`, just shorter).

>  {
>  	int n, counted;
>  	struct commit_list *p;
> @@ -313,7 +313,7 @@ static struct commit_list *do_find_bisection(struct commit_list *list,
>  		clear_distance(list);
>  
>  		/* Does it happen to be at exactly half-way? */
> -		if (!find_all && halfway(p, nr))
> +		if (!(bisect_flags & BISECT_FIND_ALL) && halfway(p, nr))

Rather than expanding the short & sweet `find_all` to `(bisect_flags &
BISECT_FIND_ALL)` in three places in this function, I would rather just
define this local variable in the beginning:

	unsigned int find_all = bisect_flags & BISECT_FIND_ALL;

This would also reduce the size of the diff.

All in all, very nice!

Ciao,
Johannes

P.S.: I fully agree with Junio and eagerly await what comes next ;-)

  parent reply	other threads:[~2018-04-18 20:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-15  8:58 [PATCH] Create 'bisect_flags' parameter in find_bisection() in preparation of passing multiple options Harald Nordgren
2018-04-15  9:55 ` Christian Couder
2018-04-15 10:44 ` [PATCH v2] Make it possible to implement bisecting only on first parents or on merge commits by passing flags to find_bisection(), instead of just a find_all boolean Harald Nordgren
2018-04-15 13:35   ` Christian Couder
2018-04-15 13:49 ` [PATCH v3] bisect: create 'bisect_flags' parameter in find_bisection() Harald Nordgren
2018-04-17  2:15   ` Junio C Hamano
2018-04-18 20:31   ` Johannes Schindelin [this message]
2018-04-18 21:05 ` [PATCH v4] " Harald Nordgren
2018-04-20 12:23   ` Johannes Schindelin

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=nycvar.QRO.7.76.6.1804182228210.4241@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz \
    --to=johannes.schindelin@gmx.de \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=haraldnordgren@gmail.com \
    --cc=sbeller@google.com \
    --cc=tiago@gitlab.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).