{"thread":{"id":"13424","subject":"[PATCH 2/2 v3] Documentation: bisect: add a few \"git bisect run\" examples","startedAt":"2008-05-07T23:00:54Z","lastAt":"2008-05-07T23:00:54Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":3,"patchTotal":2},"messages":[{"id":"76334","messageId":"20080508010054.e0c48934.chriscool@tuxfamily.org","threadId":"13424","inReplyTo":null,"subject":"[PATCH 2/2 v3] Documentation: bisect: add a few \"git bisect run\" examples","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-05-07T23:00:54Z","receivedAt":"2008-05-07T23:00:54Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Before this patch, there were no \"git bisect run\" example.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n Documentation/git-bisect.txt |   49 ++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 49 insertions(+), 0 deletions(-)\n\n\tChanges since the previous version:\n\n\t- add an example for a broken test suite\n\t- use \"cat\" to show the content of \"~/test.sh\"\n\t- tell that it's safer to have test scripts outside the repo\n\n\tThank you all for your comments. \n\ndiff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\nindex 698ffde..539f37d 100644\n--- a/Documentation/git-bisect.txt\n+++ b/Documentation/git-bisect.txt\n@@ -224,6 +224,55 @@ tree to the pristine state.  Finally the \"run\" script can exit with\n the status of the real test to let \"git bisect run\" command loop to\n know the outcome.\n \n+EXAMPLES\n+--------\n+\n+* Automatically bisect a broken build between v1.2 and HEAD:\n++\n+------------\n+$ git bisect start HEAD v1.2 --      # HEAD is bad, v1.2 is good\n+$ git bisect run make                # \"make\" builds the app\n+------------\n+\n+* Automatically bisect a broken test suite:\n++\n+------------\n+$ cat ~/test.sh\n+#!/bin/sh\n+make || exit 125                   # this \"skip\"s broken builds\n+make test                          # \"make test\" runs the test suite\n+$ git bisect start v1.3 v1.1 --    # v1.3 is bad, v1.1 is good\n+$ git bisect run ~/test.sh\n+------------\n++\n+Here we use a \"test.sh\" custom script. In this script, if \"make\"\n+fails, we \"skip\" the current commit.\n++\n+It's safer to use a custom script outside the repo to prevent\n+interactions between the bisect, make and test processes and the\n+script.\n++\n+And \"make test\" should \"exit 0\", if the test suite passes, and\n+\"exit 1\" (for example) otherwise.\n+\n+* Automatically bisect a broken test case:\n++\n+------------\n+$ cat ~/test.sh\n+#!/bin/sh\n+make || exit 125                     # this \"skip\"s broken builds\n+~/check_test_case.sh                 # does the test case passes ?\n+$ git bisect start HEAD HEAD~10 --   # culprit is among the last 10\n+$ git bisect run ~/test.sh\n+------------\n++\n+Here \"check_test_case.sh\" should \"exit 0\", if the test case passes,\n+and \"exit 1\" (for example) otherwise.\n++\n+It's safer if both \"test.sh\" and \"check_test_case.sh\" scripts are\n+outside the repo to prevent interactions between the bisect, make and\n+test processes and the scripts.\n+\n Author\n ------\n Written by Linus Torvalds <torvalds@osdl.org>\n-- \n1.5.5.1.273.g4b50\n"}]}