@matheusbsbs / matheus-bagliano / commits / 42ba5ee776
Fork 0

bisect: print an error message when "git rev-list --bisect-vars" fails

Before this patch no error was printed when "git rev-list --bisect-vars" failed. This can happen when bad and good revs are mistaken. This patch prints an error message on stderr that describe the likely failure cause. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed May 7, 2008 at 23:54 UTC 42ba5ee776c00369ca72b76537ae622611a7b545
2 files changed +24 -2
git-bisect.sh
+17 -2
@@ -220,18 +220,33 @@ bisect_auto_next() {
220 bisect_next_check && bisect_next || :
221 }
222
223 +eval_rev_list() {
224 + _eval="$1"
225 +
226 + eval $_eval
227 + res=$?
228 +
229 + if [ $res -ne 0 ]; then
230 + echo >&2 "'git rev-list --bisect-vars' failed:"
231 + echo >&2 "maybe you mistake good and bad revs?"
232 + exit $res
233 + fi
234 +
235 + return $res
236 +}
237 +
238 filter_skipped() {
239 _eval="$1"
240 _skip="$2"
241
242 if [ -z "$_skip" ]; then
228 - eval $_eval
243 + eval_rev_list "$_eval"
244 return
245 fi
246
247 # Let's parse the output of:
248 # "git rev-list --bisect-vars --bisect-all ..."
234 - eval $_eval | while read hash line
249 + eval_rev_list "$_eval" | while read hash line
250 do
251 case "$VARS,$FOUND,$TRIED,$hash" in
252 # We display some vars.
t/t6030-bisect-porcelain.sh
+7
@@ -302,6 +302,13 @@ test_expect_success 'bisect refuses to start if branch new-bisect exists' '
302 git branch -d new-bisect
303 '
304
305 +test_expect_success 'bisect errors out if bad and good are mistaken' '
306 + git bisect reset &&
307 + test_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&
308 + grep "mistake good and bad" rev_list_error &&
309 + git bisect reset
310 +'
311 +
312 #
313 #
314 test_done