git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Aaron Lipman <alipman88@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 3/3] bisect: combine args passed to find_bisection()
Date: Wed, 29 Jul 2020 21:32:14 -0700	[thread overview]
Message-ID: <xmqqr1st7hdd.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200730002735.87655-4-alipman88@gmail.com> (Aaron Lipman's message of "Wed, 29 Jul 2020 20:27:35 -0400")

Aaron Lipman <alipman88@gmail.com> writes:

> Now that find_bisection() accepts multiple boolean arguments, these may
> be combined into a single unsigned integer in order to declutter some of
> the code in bisect.c

I'd rather call them "flags" without "bisect_".  If we are passing
two sets of flags, one set about "bisect" and the other set about
something else, it would make quite a lot of sense to call the first
set "bisect_flags", but what we are seeing here is not like that.

> +	if (read_first_parent_option())
> +		bisect_flags |= BISECT_FIRST_PARENT;
> +
> +	if (!!skipped_revs.nr)
> +		bisect_flags |= BISECT_FIND_ALL;
> +

You do not care what kind of "true" you are feeding "if()", so I do
not think you would want to keep !! prefix here.  Older API into
find_bisection() may wanted to say "pass 1 to find_all", in which
case, normalizing with !! prefix may have made perfect sense, but 
that no longer holds here.

> +
> +	revs.first_parent_only = !!(bisect_flags & BISECT_FIRST_PARENT);

On the other hand, this !! may make sense; especially since .first_parent_only
could just be a one-bit unsigned bitfield.

>  	revs.limited = 1;
>  
>  	bisect_common(&revs);
>  
> -	find_bisection(&revs.commits, &reaches, &all, !!skipped_revs.nr, first_parent_only);
> +	find_bisection(&revs.commits, &reaches, &all, bisect_flags);

> @@ -23,6 +23,9 @@ struct commit_list *filter_skipped(struct commit_list *list,
>  #define BISECT_SHOW_ALL		(1<<0)
>  #define REV_LIST_QUIET		(1<<1)
>  
> +#define BISECT_FIND_ALL		(1u<<0)
> +#define BISECT_FIRST_PARENT	(1u<<1)

The set of bits to go to your "bisect_flags" are only these two new
ones, and the existing BISECT_SHOW_ALL does not belong to it (it is
a bit in rev_list_info.flags), but it is not apparent.  I wonder if
there is a good way to help readers easily tell these two sets apart.
These are flags passed to find_bisection(), so perhaps

    #define FIND_BISECTION_ALL (1U<<0)
    #define FIND_BISECTION_FIRST_PARENT_ONLY (1U<<1)

    unsigned flags = 0;
    if (first_parent)
	flags |= FIND_BISECTION_FIRST_PARENT_ONLY;
    ...
    find_bisection(..., flags);

would be a reasonable compromise?

Thanks.

  reply	other threads:[~2020-07-30  4:32 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 15:44 [PATCH 0/3] Introduce --first-parent flag for git bisect Aaron Lipman via GitGitGadget
2020-07-28 15:44 ` [PATCH 1/3] rev-list: allow bisect and first-parent flags Aaron Lipman via GitGitGadget
2020-07-28 20:23   ` Junio C Hamano
2020-07-28 21:53     ` Junio C Hamano
2020-07-28 15:44 ` [PATCH 2/3] bisect: introduce first-parent flag Aaron Lipman via GitGitGadget
2020-07-28 15:44 ` [PATCH 3/3] bisect: combine args passed to find_bisection() Aaron Lipman via GitGitGadget
2020-07-30  0:27 ` [PATCH v2 0/3] Introduce --first-parent flag for git bisect Aaron Lipman
2020-07-30  0:27   ` [PATCH v2 1/3] rev-list: allow bisect and first-parent flags Aaron Lipman
2020-07-30  0:27   ` [PATCH v2 2/3] bisect: introduce first-parent flag Aaron Lipman
2020-07-30  4:17     ` Junio C Hamano
2020-07-30  0:27   ` [PATCH v2 3/3] bisect: combine args passed to find_bisection() Aaron Lipman
2020-07-30  4:32     ` Junio C Hamano [this message]
2020-07-30  0:48   ` [PATCH v2 0/3] Introduce --first-parent flag for git bisect Junio C Hamano
2020-08-01 17:58   ` [PATCH v3 0/4] " Aaron Lipman
2020-08-01 17:58     ` [PATCH v3 1/4] rev-list: allow bisect and first-parent flags Aaron Lipman
2020-08-01 17:58     ` [PATCH v3 2/4] bisect: introduce first-parent flag Aaron Lipman
2020-08-01 17:58     ` [PATCH v3 3/4] bisect: combine args passed to find_bisection() Aaron Lipman
2020-08-01 19:30       ` Martin Ågren
2020-08-01 17:58     ` [PATCH v3 4/4] bisect: consistent style for git bisect run tests Aaron Lipman
2020-08-01 19:27       ` Martin Ågren
2020-08-01 19:06     ` [PATCH v3 0/4] Introduce --first-parent flag for git bisect Junio C Hamano
2020-08-04 22:01     ` [PATCH v4 0/5] " Aaron Lipman
2020-08-04 22:01       ` [PATCH v4 1/5] t6030: modernize "git bisect run" tests Aaron Lipman
2020-08-05  6:11         ` Christian Couder
2020-08-04 22:01       ` [PATCH v4 2/5] rev-list: allow bisect and first-parent flags Aaron Lipman
2020-08-05  0:38         ` Eric Sunshine
2020-08-04 22:01       ` [PATCH v4 3/5] cmd_bisect__helper: defer parsing no-checkout flag Aaron Lipman
2020-08-04 22:01       ` [PATCH v4 4/5] bisect: introduce first-parent flag Aaron Lipman
2020-08-04 22:01       ` [PATCH v4 5/5] bisect: combine args passed to find_bisection() Aaron Lipman
2020-08-04 22:19       ` [PATCH v4 0/5] Introduce --first-parent flag for git bisect Junio C Hamano
2020-08-05  5:55       ` Christian Couder
2020-08-07 21:05         ` Junio C Hamano
2020-08-07 21:17           ` Eric Sunshine
2020-08-07 22:07             ` Junio C Hamano
2020-08-07 22:20               ` Eric Sunshine
2020-08-05  6:18       ` Martin Ågren
2020-08-07 21:58       ` [PATCH v5 " Aaron Lipman
2020-08-07 21:58         ` [PATCH v5 1/5] t6030: modernize "git bisect run" tests Aaron Lipman
2020-08-07 21:58         ` [PATCH v5 2/5] rev-list: allow bisect and first-parent flags Aaron Lipman
2020-08-07 21:58         ` [PATCH v5 3/5] cmd_bisect__helper: defer parsing no-checkout flag Aaron Lipman
2020-08-07 21:58         ` [PATCH v5 4/5] bisect: introduce first-parent flag Aaron Lipman
2020-08-07 21:58         ` [PATCH v5 5/5] bisect: combine args passed to find_bisection() Aaron Lipman

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=xmqqr1st7hdd.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=alipman88@gmail.com \
    --cc=git@vger.kernel.org \
    --subject='Re: [PATCH v2 3/3] bisect: combine args passed to find_bisection()' \
    /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

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).