bisect: fix "git bisect skip <commit>" and add tests cases
The patch that allows "git bisect skip" to be passed a range of commits using the "<commit1>..<commit2>" notation is flawed because it introduces a regression when it was passed a simple rev or commit. "git bisect skip <commit>" doesn't work any more, because <commit> is quoted but not properly unquoted. This patch fixes that and add tests cases to better check when it is passed commits and range of commits. While at it, this patch also properly quotes the non range arguments using the "sq" function. Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Christian Couder committed
Dec 2, 2008 at 14:53 UTC
1a66a489d09e7b8629fa7e4184c78703f4eed335
2 files changed
+20
-3
git-bisect.sh
+2
-2
@@ -199,11 +199,11 @@ bisect_skip() {
199
*..*)
200
revs=$(git rev-list "$arg") || die "Bad rev input: $arg" ;;
201
*)
202
- revs="'$arg'" ;;
202
+ revs=$(sq "$arg") ;;
203
esac
204
all="$all $revs"
205
done
206
- bisect_state 'skip' $all
206
+ eval bisect_state 'skip' $all
207
}
208
209
bisect_state() {
t/t6030-bisect-porcelain.sh
+18
-1
@@ -313,8 +313,25 @@ test_expect_success 'bisect run & skip: find first bad' '
313
grep "$HASH6 is first bad commit" my_bisect_log.txt
314
'
315
316
-test_expect_success 'bisect starting with a detached HEAD' '
316
+test_expect_success 'bisect skip only one range' '
317
+ git bisect reset &&
318
+ git bisect start $HASH7 $HASH1 &&
319
+ git bisect skip $HASH1..$HASH5 &&
320
+ test "$HASH6" = "$(git rev-parse --verify HEAD)" &&
321
+ test_must_fail git bisect bad > my_bisect_log.txt &&
322
+ grep "first bad commit could be any of" my_bisect_log.txt
323
+'
324
325
+test_expect_success 'bisect skip many ranges' '
326
+ git bisect start $HASH7 $HASH1 &&
327
+ test "$HASH4" = "$(git rev-parse --verify HEAD)" &&
328
+ git bisect skip $HASH2 $HASH2.. ..$HASH5 &&
329
+ test "$HASH6" = "$(git rev-parse --verify HEAD)" &&
330
+ test_must_fail git bisect bad > my_bisect_log.txt &&
331
+ grep "first bad commit could be any of" my_bisect_log.txt
332
+'
333
+
334
+test_expect_success 'bisect starting with a detached HEAD' '
335
git bisect reset &&
336
git checkout master^ &&
337
HEAD=$(git rev-parse --verify HEAD) &&