git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH v4] Implement --first-parent for git rev-list --bisect

From
Junio C Hamano <gitster@pobox.com>
Date
May 28, 2018, 13:25 UTC
Message-ID
<xmqqzi0jj4jc.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180528092017.19022-1-tiagonbotelho@hotmail.com>
Tiago Botelho <tiagonbotelho@gmail.com> writes:
Show 11 quoted lines
> diff --git a/bisect.c b/bisect.c
> index 4eafc8262..e58cb8d62 100644
> --- a/bisect.c
> +++ b/bisect.c
> @@ -33,6 +33,8 @@ static const char *term_good;
>   *
>   * We care just barely enough to avoid recursing for
>   * non-merge entries.
> + *
> + * Note: This function does not support the usage --first-parent.
>   */

Hmph, is this because we know --first-parent codepath currently does not call this function, so we do not bother to prepare this function to be called from --first-parent codepath?

I am not saying that we must prepare this function to be callable with --first-parent; if I have to wonder why the above comment is there and what it is trying to say, I suspect most other readers would, too, so...

Show 45 quoted lines
> diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh
> index a66140803..774d9a4fd 100755
> --- a/t/t6002-rev-list-bisect.sh
> +++ b/t/t6002-rev-list-bisect.sh
> @@ -263,4 +263,41 @@ test_expect_success 'rev-parse --bisect can default to good/bad refs' '
>  	test_cmp expect.sorted actual.sorted
>  '
>  
> +# We generate the following commit graph:
> +#
> +#   B - C
> +#  /      \
> +# A        FX
> +#  \      /
> +#   D - EX
> +
> +test_expect_success 'setup' '
> +  test_commit A &&
> +  test_commit B &&
> +  test_commit C &&
> +  git reset --hard A &&
> +  test_commit D &&
> +  test_commit EX &&
> +  test_merge FX C
> +'
> +
> +test_output_expect_success "--bisect --first-parent" 'git rev-list --bisect --first-parent FX ^A' <<EOF
> +$(git rev-parse EX)
> +EOF
> +
> +test_output_expect_success "--bisect-vars --first-parent" 'git rev-list --bisect-vars --first-parent FX ^A' <<EOF
> +bisect_rev='$(git rev-parse EX)'
> +bisect_nr=1
> +bisect_good=0
> +bisect_bad=1
> +bisect_all=3
> +bisect_steps=1
> +EOF
> +
> +test_output_expect_success "--bisect-all --first-parent" 'git rev-list --bisect-all --first-parent FX ^A' <<EOF
> +$(git rev-parse EX) (dist=1)
> +$(git rev-parse D) (dist=1)
> +$(git rev-parse FX) (dist=0)
> +EOF
> +

These are all good basic tests, but can you come up with a test that demonstrates breakage in the previous round that has been fixed in this version of the patch?

Thanks.
Previous: Tiago BotelhoNext: Junio C Hamano
Message 2 of 5 in “Implement --first-parent for git rev-list --bisect”
  1. Implement --first-parent for git rev-list --bisectTiago Botelho, May 28, 2018
  2. Junio C HamanoMay 28, 2018
  3. Junio C HamanoMay 28, 2018
  4. Tiago BotelhoMay 28, 2018
  5. Junio C HamanoMay 28, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.