Code

Move #include <sys/select.h> and <sys/ioctl.h> to git-compat-util.h.
[git.git] / git-bisect.sh
index f8d0099059b2f9bdb27e2bad4f742752ee18c502..1ed44e56ad5021a74b2a0ec3e91849e55d4a67ce 100755 (executable)
@@ -1,12 +1,14 @@
 #!/bin/sh
 
-USAGE='[start|bad|good|next|reset|visualize|replay|log|run]'
+USAGE='[start|bad|good|skip|next|reset|visualize|replay|log|run]'
 LONG_USAGE='git bisect start [<bad> [<good>...]] [--] [<pathspec>...]
         reset bisect state and start bisection.
 git bisect bad [<rev>]
         mark <rev> a known-bad revision.
 git bisect good [<rev>...]
         mark <rev>... known-good revisions.
+git bisect skip [<rev>...]
+        mark <rev>... untestable revisions.
 git bisect next
         find next bisection to test and check it out.
 git bisect reset [<branch>]
@@ -17,8 +19,6 @@ git bisect replay <logfile>
         replay bisection log.
 git bisect log
         show bisect log.
-git bisect skip [<rev>...]
-        mark <rev>... untestable revisions.
 git bisect run <cmd>...
         use <cmd>... to automatically bisect.'
 
@@ -275,7 +275,8 @@ exit_if_skipped_commits () {
        if expr "$_tried" : ".*[|].*" > /dev/null ; then
                echo "There are only 'skip'ped commit left to test."
                echo "The first bad commit could be any of:"
-               echo "$_tried" | sed -e 's/[|]/\n/g'
+               echo "$_tried" | sed -e 's/[|]/\
+/g'
                echo "We cannot bisect more!"
                exit 2
        fi
@@ -392,7 +393,10 @@ bisect_run () {
       fi
 
       # Find current state depending on run success or failure.
-      if [ $res -gt 0 ]; then
+      # A special exit code of 125 means cannot test.
+      if [ $res -eq 125 ]; then
+         state='skip'
+      elif [ $res -gt 0 ]; then
          state='bad'
       else
          state='good'
@@ -404,6 +408,12 @@ bisect_run () {
 
       cat "$GIT_DIR/BISECT_RUN"
 
+      if grep "first bad commit could be any of" "$GIT_DIR/BISECT_RUN" \
+               > /dev/null; then
+         echo >&2 "bisect run cannot continue any more"
+         exit $res
+      fi
+
       if [ $res -ne 0 ]; then
          echo >&2 "bisect run failed:"
          echo >&2 "'bisect_state $state' exited with error code $res"