{"thread":{"id":"16445","subject":"[RFC/PATCH v2] bisect: teach \"skip\" to accept special arguments like \"A..B\"","startedAt":"2008-11-24T16:33:13Z","lastAt":"2008-11-24T16:33:13Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"96425","messageId":"20081124173313.90cff3a0.chriscool@tuxfamily.org","threadId":"16445","inReplyTo":null,"subject":"[RFC/PATCH v2] bisect: teach \"skip\" to accept special arguments like \"A..B\"","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-11-24T16:33:13Z","receivedAt":"2008-11-24T16:33:13Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"The current \"git bisect skip\" syntax is \"git bisect skip [<rev>...]\"\nso it's already possible to skip a range of revisions using\nsomething like:\n\n$ git bisect skip $(git rev-list A..B)\n\nwhere A and B are the bounds of the range we want to skip.\n\nThis patch teaches \"git bisect skip\" to accept:\n\n$ git bisect skip A..B\n\nas an abbreviation for the former command.\n\nThis is done by checking each argument to see if it contains two\ndots one after the other ('..'), and by expanding it using\n\"git rev-list\" if that is the case.\n\nNote that this patch will not make \"git bisect skip\" accept all\nthat \"git rev-list\" accepts, as things like \"^A B\" for exemple\nwill not work. But things like \"A B..C D E F.. ..G H...I\" should\nwork as expected.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n git-bisect.sh |   19 ++++++++++++++++++-\n 1 files changed, 18 insertions(+), 1 deletions(-)\n\n\tChange since last time: s/expend/expand/\n\n\tI am still not sure if this patch is worth it because\n\tthis is a special case in many ways.\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 0d0e278..6706bc1 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -191,6 +191,21 @@ check_expected_revs() {\n \tdone\n }\n \n+bisect_skip() {\n+        all=''\n+\tfor arg in \"$@\"\n+\tdo\n+\t    case \"$arg\" in\n+            *..*)\n+                revs=$(git rev-list \"$arg\") || die \"Bad rev input: $arg\" ;;\n+            *)\n+                revs=\"'$arg'\" ;;\n+\t    esac\n+            all=\"$all $revs\"\n+        done\n+        bisect_state 'skip' $all\n+}\n+\n bisect_state() {\n \tbisect_autostart\n \tstate=$1\n@@ -630,8 +645,10 @@ case \"$#\" in\n         git bisect -h ;;\n     start)\n         bisect_start \"$@\" ;;\n-    bad|good|skip)\n+    bad|good)\n         bisect_state \"$cmd\" \"$@\" ;;\n+    skip)\n+        bisect_skip \"$@\" ;;\n     next)\n         # Not sure we want \"next\" at the UI level anymore.\n         bisect_next \"$@\" ;;\n-- \n1.6.0.4.617.g39d03\n"}]}