-
-
Save 3gx/d7f58411e941fa7dec13 to your computer and use it in GitHub Desktop.
Revisions
-
cheeming revised this gist
Jun 23, 2012 . 1 changed file with 5 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ function print_usage () { echo usage: $0 LAST_KNOWN_GOOD_REVISION '"TEST_COMMAND"' echo LAST_KNOWN_GOOD_REVISION = you can specify this as sha1 hash echo TEST_COMMAND = the script to run, it should return 0 if success echo NOTE: Ensure that the current revision is the bad \(broken\) exit 1; } @@ -28,25 +29,7 @@ read _tmp git bisect start git bisect bad git bisect good $LAST_KNOWN_GOOD_REVISION git bisect run bash -c "${TEST_COMMAND}" git bisect log echo run the following to reset git bisect echo git bisect reset -
cheeming revised this gist
Jun 23, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ git bisect bad git bisect good $LAST_KNOWN_GOOD_REVISION while true; do echo running test command... \( ${TEST_COMMAND} \) eval "( ${TEST_COMMAND} )" if [ $? -ne 0 ]; then -
cheeming revised this gist
Jun 23, 2012 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ function print_usage () { echo usage: $0 LAST_KNOWN_GOOD_REVISION '"TEST_COMMAND"' echo LAST_KNOWN_GOOD_REVISION = you can specify this as sha1 hash echo TEST_COMMAND = the script to run, it should return 0 if success exit 1; } @@ -21,6 +21,10 @@ if [ -z "${TEST_COMMAND}" ]; then print_usage fi # TODO: should have a flag to skip this, so that it can be automated echo "ensure HEAD is bad (broken), press enter to continue or ctrl-c to leave to setup..." read _tmp git bisect start git bisect bad git bisect good $LAST_KNOWN_GOOD_REVISION -
cheeming created this gist
Jun 23, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ #!/bin/bash function print_usage () { echo usage: $0 LAST_KNOWN_GOOD_REVISION '"TEST_COMMAND"' echo LAST_KNOWN_GOOD_REVISION = you can specify this as branch, tag or sha1 hash echo TEST_COMMAND = the script to run, it should return 0 if success exit 1; } LAST_KNOWN_GOOD_REVISION=$1 if [ -z "${LAST_KNOWN_GOOD_REVISION}" ]; then echo please enter last known revision that was good >> /dev/stderr print_usage fi TEST_COMMAND=$2 if [ -z "${TEST_COMMAND}" ]; then echo "please enter a test command (script/program/whatever)" >> /dev/stderr print_usage fi git bisect start git bisect bad git bisect good $LAST_KNOWN_GOOD_REVISION while true; do echo 'running test command... "( ${TEST_COMMAND} )" ' eval "( ${TEST_COMMAND} )" if [ $? -ne 0 ]; then PREV_COMMIT=`git log --pretty=format:"%H" -1` git bisect bad CURR_COMMIT=`git log --pretty=format:"%H" -1` echo PREV_COMMIT=${PREV_COMMIT} CURR_COMMIT=${CURR_COMMIT} if [ "${PREV_COMMIT}" == "${CURR_COMMIT}" ]; then echo no more revisions to test git bisect log echo run the following to reset git bisect echo git bisect reset break fi else echo revision is good, continue bisecting ... git bisect good fi done;