From 8f69f72fca989b3ba080aab1dc24bfd1709ce83a Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sun, 28 Feb 2010 23:19:09 +0100 Subject: bisect: error out when passing bad path parameters As reported by Mark Lodato, "git bisect", when it was started with path parameters that match no commit was kind of working without taking account of path parameters and was reporting something like: Bisecting: -1 revisions left to test after this (roughly 0 steps) It is more correct and safer to just error out in this case, before displaying the revisions left, so this patch does just that. Note that this bug is very old, it exists at least since v1.5.5. And it is possible to detect that case earlier in the bisect algorithm, but it is not clear that it would be an improvement to error out earlier, on the contrary it may change the behavior of "git rev-list --bisect-all" for example, which is currently correct. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- bisect.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bisect.c') diff --git a/bisect.c b/bisect.c index dc18db8af..88881f7b6 100644 --- a/bisect.c +++ b/bisect.c @@ -986,6 +986,12 @@ int bisect_next_all(const char *prefix) exit(1); } + if (!all) { + fprintf(stderr, "No testable commit found.\n" + "Maybe you started with bad path parameters?\n"); + exit(4); + } + bisect_rev = revs.commits->item->object.sha1; memcpy(bisect_rev_hex, sha1_to_hex(bisect_rev), 41); -- cgit v1.2.1