{"thread":{"id":"48554","subject":"[RFC PATCH v3 2/2] Add tests for rev-list --bisect* --first-parent","startedAt":"2018-05-23T12:01:18Z","lastAt":"2018-05-24T02:42:25Z","messageCount":2,"participants":["Tiago Botelho","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":2},"messages":[{"id":"348368","messageId":"20180523120110.36532-1-tiagonbotelho@hotmail.com","threadId":"48554","inReplyTo":null,"subject":"[RFC PATCH v3 2/2] Add tests for rev-list --bisect* --first-parent","fromName":"Tiago Botelho","fromEmail":"tiagonbotelho@gmail.com","sentAt":"2018-05-23T12:01:10Z","receivedAt":"2018-05-23T12:01:18Z","isPatch":true,"sender":{"key":"tiagonbotelho@gmail.com","avatar":"https://gravatar.com/avatar/263ea75fe0d4aa4ac14fa9dd08b82955689b6769cf5d33599914ca4321a4597b?d=mp&s=160"},"body":"---\n t/t6002-rev-list-bisect.sh | 39 +++++++++++++++++++++++++++++++++++++++\n 1 file changed, 39 insertions(+)\n\ndiff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh\nindex a66140803..977c82157 100755\n--- a/t/t6002-rev-list-bisect.sh\n+++ b/t/t6002-rev-list-bisect.sh\n@@ -263,4 +263,43 @@ test_expect_success 'rev-parse --bisect can default to good/bad refs' '\n \ttest_cmp expect.sorted actual.sorted\n '\n \n+# We generate the following commit graph:\n+#\n+#     A\n+#    / \\\n+#   D   B\n+#   |   |\n+#   EX  C\n+#    \\  /\n+#     FX\n+\n+test_expect_success 'setup' '\n+  test_commit A &&\n+  test_commit B &&\n+  test_commit C &&\n+  git reset --hard A &&\n+  test_commit D &&\n+  test_commit EX &&\n+  test_merge FX C\n+'\n+\n+test_output_expect_success \"--bisect --first-parent\" 'git rev-list --bisect --first-parent FX ^A' <<EOF\n+$(git rev-parse EX)\n+EOF\n+\n+test_output_expect_success \"--bisect-vars --first-parent\" 'git rev-list --bisect-vars --first-parent FX ^A' <<EOF\n+bisect_rev='$(git rev-parse EX)'\n+bisect_nr=1\n+bisect_good=0\n+bisect_bad=1\n+bisect_all=3\n+bisect_steps=1\n+EOF\n+\n+test_output_expect_success \"--bisect-all --first-parent\" 'git rev-list --bisect-all --first-parent FX ^A' <<EOF\n+$(git rev-parse D) (dist=1)\n+$(git rev-parse EX) (dist=1)\n+$(git rev-parse FX) (dist=0)\n+EOF\n+\n test_done\n-- \n2.16.3\n\n"},{"id":"348401","messageId":"xmqq7entu646.fsf@gitster-ct.c.googlers.com","threadId":"48554","inReplyTo":"20180523120110.36532-1-tiagonbotelho@hotmail.com","subject":"Re: [RFC PATCH v3 2/2] Add tests for rev-list --bisect* --first-parent","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-24T02:42:17Z","receivedAt":"2018-05-24T02:42:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tiago Botelho <tiagonbotelho@gmail.com> writes:\n\n> Subject: [RFC PATCH v3 1/2] Implement --first-parent for git rev-list --bisect\n> Subject: [RFC PATCH v3 2/2] Add tests for rev-list --bisect* --first-parent\n\nperhaps\n\n\tbisect: teach \"git rev-list --bisect\" to work with \"--first-parent\"\n\tbisect: test \"git rev-list --first-parent --bisect\"\n\nor soemthing?  I _think_ it is probably preferrable to have the test\nin the primary patch, making these two patches into one.\n\n> ---\n>  t/t6002-rev-list-bisect.sh | 39 +++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 39 insertions(+)\n>\n> diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh\n> index a66140803..977c82157 100755\n> --- a/t/t6002-rev-list-bisect.sh\n> +++ b/t/t6002-rev-list-bisect.sh\n> @@ -263,4 +263,43 @@ test_expect_success 'rev-parse --bisect can default to good/bad refs' '\n>  \ttest_cmp expect.sorted actual.sorted\n>  '\n>  \n> +# We generate the following commit graph:\n> +#\n> +#     A\n> +#    / \\\n> +#   D   B\n> +#   |   |\n> +#   EX  C\n> +#    \\  /\n> +#     FX\n\nExisting ascii art in the same script seems to draw the history\ngrowing from bottom to top, the other way around.  Please be\nconsistent.  I think that we tend to draw simple histories growing\nfrom left to right, and a more complex ones from bottom to top.\n\n> +test_expect_success 'setup' '\n> +  test_commit A &&\n> +  test_commit B &&\n> +  test_commit C &&\n> +  git reset --hard A &&\n> +  test_commit D &&\n> +  test_commit EX &&\n> +  test_merge FX C\n> +'\n> +\n> +test_output_expect_success \"--bisect --first-parent\" 'git rev-list --bisect --first-parent FX ^A' <<EOF\n> +$(git rev-parse EX)\n> +EOF\n\nOK, because our range has odd number of commits on the first-parent\nchain, the middle one is unambiguously the one to pick.\n\n> +test_output_expect_success \"--bisect-vars --first-parent\" 'git rev-list --bisect-vars --first-parent FX ^A' <<EOF\n> +bisect_rev='$(git rev-parse EX)'\n> +bisect_nr=1\n> +bisect_good=0\n> +bisect_bad=1\n> +bisect_all=3\n> +bisect_steps=1\n> +EOF\n> +\n> +test_output_expect_success \"--bisect-all --first-parent\" 'git rev-list --bisect-all --first-parent FX ^A' <<EOF\n> +$(git rev-parse D) (dist=1)\n> +$(git rev-parse EX) (dist=1)\n> +$(git rev-parse FX) (dist=0)\n> +EOF\n> +\n>  test_done\n"}]}