From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Tiago Botelho <tiagonbotelho@gmail.com>,
git@vger.kernel.org, christian.couder@gmail.com,
haraldnordgren@gmail.com,
Tiago Botelho <tiagonbotelho@hotmail.com>
Subject: Re: [PATCH v6] Implement --first-parent for git rev-list --bisect
Date: Tue, 28 Aug 2018 11:39:47 -0700 [thread overview]
Message-ID: <xmqqy3cqfi8c.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1808281512240.73@tvgsbejvaqbjf.bet> (Johannes Schindelin's message of "Tue, 28 Aug 2018 15:21:09 +0200 (DST)")
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Hi Tiago,
>
> On Tue, 28 Aug 2018, Tiago Botelho wrote:
>
>> This will enable users to implement bisecting on first parents
>> which can be useful for when the commits from a feature branch
>> that we want to merge are not always tested.
>
> This message is still lacking the explanation I asked for, namely for the
> lines:
>
> @@ -329,6 +334,11 @@ static struct commit_list *do_find_bisection(struct commit_list *list,
> if (0 <= weight(p))
> continue;
> for (q = p->item->parents; q; q = q->next) {
> + if ((bisect_flags & BISECT_FIRST_PARENT)) {
> + if (weight(q) < 0)
> + q = NULL;
> + break;
> + }
> if (q->item->object.flags & UNINTERESTING)
> continue;
> if (0 <= weight(q))
I've just finished scanning the discussion thread on public-inbox
for v5, v4, v3, v2 and the initial round of this series, but found
your comments only on the tests. If you have a pointer that would
be great; it also is OK to say what kind of explanation is needed
for that addition again.
FWIW I too was puzzled about the correctness of the added logic
above, especially the part that reads weight(q) before checking if
it is not UNINTERESTING, but I covered it on a separate message.
> I would have preferred to reuse the already existing commits generated in
> the `setup` phase rather than generating yet another batch, and to not
> introduce an inconsistent way to present a commit graph (compare your
> diagram with the one in
> https://github.com/git/git/blob/v2.18.0/t/t6002-rev-list-bisect.sh#L64-L90
> i.e. *in the same file*)
As I already said in the previous round, I do agree with these.
That is, ...
>> diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh
>> index a66140803..1bc297de5 100755
>> --- a/t/t6002-rev-list-bisect.sh
>> +++ b/t/t6002-rev-list-bisect.sh
>> @@ -263,4 +263,62 @@ 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 - CC - EX
>> +
>> +test_expect_success 'setup' '
>> + test_commit A &&
>> + test_commit B &&
>> + test_commit C &&
>> + git reset --hard A &&
>> + test_commit D &&
>> + test_commit CC &&
>> + test_commit EX &&
>> + test_merge FX C
>> +'
... the above graph construction should not be necessary. An
earlier part of t6002 would have already created a history of
suitable shape to use for writing the following tests.
>> +test_output_expect_success "--bisect --first-parent" 'git rev-list --bisect --first-parent FX ^A' <<EOF
>> +$(git rev-parse CC)
>> +EOF
>> +
>> +test_output_expect_success "--first-parent" 'git rev-list --first-parent FX ^A' <<EOF
>> +$(git rev-parse FX)
>> +$(git rev-parse EX)
>> +$(git rev-parse CC)
>> +$(git rev-parse D)
>> +EOF
>> +
>> +test_output_expect_success "--bisect-vars --first-parent" 'git rev-list --bisect-vars --first-parent FX ^A' <<EOF
>> +bisect_rev='$(git rev-parse CC)'
>> +bisect_nr=1
>> +bisect_good=1
>> +bisect_bad=1
>> +bisect_all=4
>> +bisect_steps=1
>> +EOF
>> +
>> +test_expect_success "--bisect-all --first-parent" '
>> +cat >expect <<EOF &&
>> +$(git rev-parse CC) (dist=2)
>> +$(git rev-parse EX) (dist=1)
>> +$(git rev-parse D) (dist=1)
>> +$(git rev-parse FX) (dist=0)
>> +EOF
>> +
>> +# Make sure we have the same entries, nothing more, nothing less
>> +git rev-list --bisect-all --first-parent FX ^A >actual &&
>> + sort actual >actual.sorted &&
>> + sort expect >expect.sorted &&
>> + test_cmp expect.sorted actual.sorted &&
>> + # Make sure the entries are sorted in the dist order
>> + sed -e "s/.*(dist=\([1-9]*[0-9]\)).*/\1/" actual >actual.dists &&
>> + sort -r actual.dists >actual.dists.sorted &&
>> + test_cmp actual.dists.sorted actual.dists
>> +'
>> +
>> test_done
>> --
>> 2.16.3
>>
>>
next prev parent reply other threads:[~2018-08-28 18:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-28 12:32 [PATCH v6] Implement --first-parent for git rev-list --bisect Tiago Botelho
2018-08-28 13:21 ` Johannes Schindelin
2018-08-28 18:39 ` Junio C Hamano [this message]
2018-08-28 20:45 ` Junio C Hamano
2018-08-28 21:24 ` Junio C Hamano
2018-08-28 16:45 ` Junio C Hamano
2018-09-02 7:34 ` Duy Nguyen
2018-09-02 7:42 ` [PATCH] bisect.c: make show_list() build again Nguyễn Thái Ngọc Duy
2018-09-02 7:57 ` Christian Couder
2018-09-03 17:31 ` Duy Nguyen
2018-09-04 11:13 ` Christian Couder
2018-09-04 19:32 ` [PATCH v6] Implement --first-parent for git rev-list --bisect Junio C Hamano
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=xmqqy3cqfi8c.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=haraldnordgren@gmail.com \
--cc=tiagonbotelho@gmail.com \
--cc=tiagonbotelho@hotmail.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).