git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/PATCH v2] bisect: teach "skip" to accept special arguments like "A..B"

From
Christian Couder <chriscool@tuxfamily.org>
Date
Nov 24, 2008, 16:33 UTC
Message-ID
<20081124173313.90cff3a0.chriscool@tuxfamily.org>

The current "git bisect skip" syntax is "git bisect skip [<rev>...]" so it's already possible to skip a range of revisions using something like:

$ git bisect skip $(git rev-list A..B)
where A and B are the bounds of the range we want to skip.
This patch teaches "git bisect skip" to accept:
$ git bisect skip A..B
as an abbreviation for the former command.

This is done by checking each argument to see if it contains two dots one after the other ('..'), and by expanding it using "git rev-list" if that is the case.

Note that this patch will not make "git bisect skip" accept all that "git rev-list" accepts, as things like "^A B" for exemple will not work. But things like "A B..C D E F.. ..G H...I" should work as expected.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git-bisect.sh |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
	Change since last time: s/expend/expand/
	I am still not sure if this patch is worth it because
	this is a special case in many ways.
diff --git a/git-bisect.sh b/git-bisect.sh
index 0d0e278..6706bc1 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -191,6 +191,21 @@ check_expected_revs() {
 	done
 }
 
+bisect_skip() {
+        all=''
+	for arg in "$@"
+	do
+	    case "$arg" in
+            *..*)
+                revs=$(git rev-list "$arg") || die "Bad rev input: $arg" ;;
+            *)
+                revs="'$arg'" ;;
+	    esac
+            all="$all $revs"
+        done
+        bisect_state 'skip' $all
+}
+
 bisect_state() {
 	bisect_autostart
 	state=$1
@@ -630,8 +645,10 @@ case "$#" in
         git bisect -h ;;
     start)
         bisect_start "$@" ;;
-    bad|good|skip)
+    bad|good)
         bisect_state "$cmd" "$@" ;;
+    skip)
+        bisect_skip "$@" ;;
     next)
         # Not sure we want "next" at the UI level anymore.
         bisect_next "$@" ;;
-- 
1.6.0.4.617.g39d03
Message 1 of 1 in “bisect: teach "skip" to accept special arguments like "A..B"”
  1. bisect: teach "skip" to accept special arguments like "A..B"Christian Couder, Nov 24, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.