{"thread":{"id":"22858","subject":"[PATCH] bisect: error out when passing bad path parameters","startedAt":"2010-02-28T22:19:09Z","lastAt":"2010-02-28T22:19:09Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"135901","messageId":"20100228221910.2217.70167.chriscool@tuxfamily.org","threadId":"22858","inReplyTo":null,"subject":"[PATCH] bisect: error out when passing bad path parameters","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2010-02-28T22:19:09Z","receivedAt":"2010-02-28T22:19:09Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"As reported by Mark Lodato, \"git bisect\", when it was started with\npath parameters that match no commit was kind of working without\ntaking account of path parameters and was reporting something like:\n\nBisecting: -1 revisions left to test after this (roughly 0 steps)\n\nIt is more correct and safer to just error out in this case, before\ndisplaying the revisions left, so this patch does just that.\n\nNote that this bug is very old, it exists at least since v1.5.5.\nAnd it is possible to detect that case earlier in the bisect\nalgorithm, but it is not clear that it would be an improvement to\nerror out earlier, on the contrary it may change the behavior of\n\"git rev-list --bisect-all\" for example, which is currently correct.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n bisect.c                    |    6 ++++++\n t/t6030-bisect-porcelain.sh |    5 +++++\n 2 files changed, 11 insertions(+), 0 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex 6dc27ee..b556b11 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -986,6 +986,12 @@ int bisect_next_all(const char *prefix)\n \t\texit(1);\n \t}\n \n+\tif (!all) {\n+\t\tfprintf(stderr, \"No testable commit found.\\n\"\n+\t\t\t\"Maybe you started with bad path parameters?\\n\");\n+\t\texit(4);\n+\t}\n+\n \tbisect_rev = revs.commits->item->object.sha1;\n \tmemcpy(bisect_rev_hex, sha1_to_hex(bisect_rev), 41);\n \ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex c51865f..3b042aa 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -567,6 +567,11 @@ test_expect_success 'skipping away from skipped commit' '\n \ttest \"$para3\" = \"$PARA_HASH3\"\n '\n \n+test_expect_success 'erroring out when using bad path parameters' '\n+\ttest_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&\n+\tgrep \"bad path parameters\" error.txt\n+'\n+\n #\n #\n test_done\n-- \n1.7.0.321.g2d270\n"}]}