{"thread":{"id":"13422","subject":"[PATCH] bisect: print an error message when \"git rev-list --bisect-vars\" fails","startedAt":"2008-05-07T21:54:28Z","lastAt":"2008-05-07T21:54:28Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"76324","messageId":"20080507235428.a3579911.chriscool@tuxfamily.org","threadId":"13422","inReplyTo":null,"subject":"[PATCH] bisect: print an error message when \"git rev-list --bisect-vars\" fails","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-05-07T21:54:28Z","receivedAt":"2008-05-07T21:54:28Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Before this patch no error was printed when \"git rev-list --bisect-vars\"\nfailed. This can happen when bad and good revs are mistaken.\n\nThis patch prints an error message on stderr that describe the likely\nfailure cause.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n git-bisect.sh               |   19 +++++++++++++++++--\n t/t6030-bisect-porcelain.sh |    7 +++++++\n 2 files changed, 24 insertions(+), 2 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex b5171c9..164e8ed 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -224,18 +224,33 @@ bisect_auto_next() {\n \tbisect_next_check && bisect_next || :\n }\n \n+eval_rev_list() {\n+\t_eval=\"$1\"\n+\n+\teval $_eval\n+\tres=$?\n+\n+\tif [ $res -ne 0 ]; then\n+\t\techo >&2 \"'git rev-list --bisect-vars' failed:\"\n+\t\techo >&2 \"maybe you mistake good and bad revs?\"\n+\t\texit $res\n+\tfi\n+\n+\treturn $res\n+}\n+\n filter_skipped() {\n \t_eval=\"$1\"\n \t_skip=\"$2\"\n \n \tif [ -z \"$_skip\" ]; then\n-\t\teval $_eval\n+\t\teval_rev_list \"$_eval\"\n \t\treturn\n \tfi\n \n \t# Let's parse the output of:\n \t# \"git rev-list --bisect-vars --bisect-all ...\"\n-\teval $_eval | while read hash line\n+\teval_rev_list \"$_eval\" | while read hash line\n \tdo\n \t\tcase \"$VARS,$FOUND,$TRIED,$hash\" in\n \t\t\t# We display some vars.\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex ccd459b..b5102fb 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -302,6 +302,13 @@ test_expect_success 'bisect refuses to start if branch new-bisect exists' '\n \tgit branch -d new-bisect\n '\n \n+test_expect_success 'bisect errors out if bad and good are mistaken' '\n+\tgit bisect reset &&\n+\ttest_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&\n+\tgrep \"mistake good and bad\" rev_list_error &&\n+\tgit bisect reset\n+'\n+\n #\n #\n test_done\n-- \n1.5.5.1.322.g312d.dirty\n"}]}