{"thread":{"id":"16554","subject":"[PATCH 1/2 v2] bisect: fix \"git bisect skip <commit>\" and add tests cases","startedAt":"2008-12-02T13:53:47Z","lastAt":"2008-12-02T13:53:47Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"96941","messageId":"20081202145347.90403957.chriscool@tuxfamily.org","threadId":"16554","inReplyTo":null,"subject":"[PATCH 1/2 v2] bisect: fix \"git bisect skip <commit>\" and add tests cases","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-12-02T13:53:47Z","receivedAt":"2008-12-02T13:53:47Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"The patch that allows \"git bisect skip\" to be passed a range of\ncommits using the \"<commit1>..<commit2>\" notation is flawed because\nit introduces a regression when it was passed a simple rev or commit.\n\n\"git bisect skip <commit>\" doesn't work any more, because <commit>\nis quoted but not properly unquoted.\n\nThis patch fixes that and add tests cases to better check when it is\npassed commits and range of commits.\n\nWhile at it, this patch also properly quotes the non range arguments\nusing the \"sq\" function.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n git-bisect.sh               |    4 ++--\n t/t6030-bisect-porcelain.sh |   19 ++++++++++++++++++-\n 2 files changed, 20 insertions(+), 3 deletions(-)\n\n\tChange since previous version: now properly quote any non\n\trange argument using \"sq\" (in patch 1/2).\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 6706bc1..ddbdba8 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -199,11 +199,11 @@ bisect_skip() {\n             *..*)\n                 revs=$(git rev-list \"$arg\") || die \"Bad rev input: $arg\" ;;\n             *)\n-                revs=\"'$arg'\" ;;\n+                revs=$(sq \"$arg\") ;;\n \t    esac\n             all=\"$all $revs\"\n         done\n-        bisect_state 'skip' $all\n+        eval bisect_state 'skip' $all\n }\n \n bisect_state() {\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex 85fa39c..dd7eac8 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -313,8 +313,25 @@ test_expect_success 'bisect run & skip: find first bad' '\n \tgrep \"$HASH6 is first bad commit\" my_bisect_log.txt\n '\n \n-test_expect_success 'bisect starting with a detached HEAD' '\n+test_expect_success 'bisect skip only one range' '\n+\tgit bisect reset &&\n+\tgit bisect start $HASH7 $HASH1 &&\n+\tgit bisect skip $HASH1..$HASH5 &&\n+\ttest \"$HASH6\" = \"$(git rev-parse --verify HEAD)\" &&\n+\ttest_must_fail git bisect bad > my_bisect_log.txt &&\n+\tgrep \"first bad commit could be any of\" my_bisect_log.txt\n+'\n \n+test_expect_success 'bisect skip many ranges' '\n+\tgit bisect start $HASH7 $HASH1 &&\n+\ttest \"$HASH4\" = \"$(git rev-parse --verify HEAD)\" &&\n+\tgit bisect skip $HASH2 $HASH2.. ..$HASH5 &&\n+\ttest \"$HASH6\" = \"$(git rev-parse --verify HEAD)\" &&\n+\ttest_must_fail git bisect bad > my_bisect_log.txt &&\n+\tgrep \"first bad commit could be any of\" my_bisect_log.txt\n+'\n+\n+test_expect_success 'bisect starting with a detached HEAD' '\n \tgit bisect reset &&\n \tgit checkout master^ &&\n \tHEAD=$(git rev-parse --verify HEAD) &&\n-- \n1.6.0.4.838.g4ea49\n"}]}