Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_bisect [2019/02/20 18:29] – [SYNOPSIS] rpjday | git_bisect [2019/02/26 21:54] (current) – [Bisection while ignoring feature branches] rpjday | ||
|---|---|---|---|
| Line 27: | Line 27: | ||
| ===== Basic bisection ===== | ===== Basic bisection ===== | ||
| - | ===== Cute features | + | ==== Defining the endpoints |
| + | |||
| + | Any of the following (bad, followed by good): | ||
| + | |||
| + | < | ||
| + | $ git bisect start v4.20 v4.19 | ||
| + | </ | ||
| + | |||
| + | or | ||
| + | |||
| + | < | ||
| + | $ git bisect start | ||
| + | $ git bisect good v4.19 | ||
| + | $ git bisect bad v4.20 | ||
| + | </ | ||
| + | |||
| + | after which you should see: | ||
| + | |||
| + | < | ||
| + | Bisecting: 7499 revisions left to test after this (roughly 13 steps) | ||
| + | [ec9c166434595382be3babf266febf876327774d] Merge tag ' | ||
| + | </ | ||
| + | |||
| + | ==== Displaying the current commit ==== | ||
| + | |||
| + | At any time, examine the current commit with: | ||
| + | |||
| + | < | ||
| + | $ git show | ||
| + | commit ec9c166434595382be3babf266febf876327774d (HEAD) | ||
| + | Merge: 685f7e4f1614 c61c7def1fa0 | ||
| + | Author: Linus Torvalds < | ||
| + | Date: Fri Oct 26 14:39:22 2018 -0700 | ||
| + | |||
| + | Merge tag ' | ||
| + | |||
| + | Pull MIPS fixes from Paul Burton: | ||
| + | " | ||
| + | hey-ho here they are now: | ||
| + | |||
| + | - A fix for potential poor stack placement introduced in v4.19-rc8. | ||
| + | |||
| + | - A fix for a warning introduced in use of TURBOchannel devices by | ||
| + | DMA changes in v4.16" | ||
| + | |||
| + | * tag ' | ||
| + | MIPS: VDSO: Reduce VDSO_RANDOMIZE_SIZE to 64MB for 64bit | ||
| + | TC: Set DMA masks for devices | ||
| + | </ | ||
| + | |||
| + | ==== The bisection step ==== | ||
| + | |||
| + | After testing the current checkout for the error, do one of: | ||
| + | |||
| + | < | ||
| + | $ git bisect good | ||
| + | $ git bisect bad | ||
| + | </ | ||
| + | |||
| + | to refine the interval containing the error. | ||
| + | |||
| + | ==== The end result ==== | ||
| + | |||
| + | After binary search, you will end up with something like: | ||
| + | |||
| + | < | ||
| + | $ git bisect good | ||
| + | 130d6f946f6f2a972ee3ec8540b7243ab99abe97 is the first bad commit | ||
| + | commit 130d6f946f6f2a972ee3ec8540b7243ab99abe97 | ||
| + | Author: Thomas Gleixner < | ||
| + | Date: Sun Nov 25 19:33:40 2018 +0100 | ||
| + | |||
| + | x86/l1tf: Show actual SMT state | ||
| + | ... snip ... | ||
| + | </ | ||
| + | |||
| + | Once you're done: | ||
| + | |||
| + | < | ||
| + | $ git bisect reset | ||
| + | </ | ||
| + | ===== Advanced | ||
| ==== Alternate terms ==== | ==== Alternate terms ==== | ||
| Line 145: | Line 226: | ||
| This option may be useful when the test you would perform in each step does not require a checked out tree. | This option may be useful when the test you would perform in each step does not require a checked out tree. | ||
| - | ===== Bisection | + | ===== Bisection |
| - | Rather than bisecting completely | + | NOTE: This explanation is based on the writeup [[https://blog.smart.ly/2015/02/ |
| - | First, list //all// revisions in the range of interest | + | If we have two commits directly on the '' |
| - | < | + | Rather than bisecting completely on those lengthy feature branches, we can restrict the search to just those commits where feature branches were merged into '' |
| - | $ git rev-list v4.14..v4.15 | + | |
| - | d8a5b80568a9cb66810e75b182018e9edb68e8ff | + | |
| - | 24b1cccf922914f3d6eeb84036dde8338bc03abb | + | |
| - | 32c6cdf75c9270848d2d0ed7c814eba05b47081f | + | |
| - | 07b0137c0268b8d0694a5f09284449353a1a6fed | + | |
| - | 624441927ff6af871d793dfa49fa347c8450e250 | + | |
| - | 39e383626caffd2b5f4407710157b32172898869 | + | |
| - | ... massive snip ... | + | |
| - | </ | + | |
| - | Just count the commits | + | First, let' |
| < | < | ||
| - | $ git rev-list v4.14..v4.15 | wc -l | + | $ git rev-list v4.18..v4.19 | wc -l |
| - | 16223 | + | 15204 |
| - | $ git rev-list ^v4.14 v4.15 | wc -l | + | |
| - | 16223 | + | |
| $ | $ | ||
| </ | </ | ||
| - | Next, restrict yourself to just merge commits | + | That's a lot of commits so let's see if we can reduce that number. The basis for ignoring all of the commits on feature branches |
| < | < | ||
| - | $ git rev-list v4.14..v4.15 --merges | wc -l | + | $ git rev-list v4.18..v4.19 --merges | wc -l |
| - | 1357 | + | 1161 |
| $ | $ | ||
| </ | </ | ||
| - | Further, follow only the // | + | So there are 1161 merge commits in the testable range, but we need to further disqualify merge commits exclusively on feature branches, so let's restrict ourselves to just the // |
| < | < | ||
| - | $ git rev-list v4.14..v4.15 --merges --first-parent | wc -l | + | $ git rev-list v4.18..v4.19 --merges --first-parent | wc -l |
| - | 435 | + | 426 |
| $ | $ | ||
| </ | </ | ||
| - | The above set of commits represents | + | What the above set of merge commits represents |
| < | < | ||
| - | $ for rev in $(git rev-list v4.14..v4.15 --merges --first-parent) ; do | + | for rev in $(git rev-list v4.18..v4.19 --merges --first-parent); |
| - | > echo ${rev} | + | git rev-list $rev^2 --not $rev^ |
| - | > done | wc -l | + | done | xargs git bisect skip |
| - | 435 | + | |
| - | $ | + | |
| </ | </ | ||
| - | Now, for each merge commit on '' | + | Given that our basic search would have processed 15204 commits, we can count how many commits |
| < | < | ||
| - | git rev-list ${rev}^2 ^${rev}^ | + | for rev in $(git rev-list v4.18..v4.19 --merges --first-parent); |
| + | | ||
| + | done | sort | uniq | wc -l | ||
| + | 14714 | ||
| + | $ | ||
| </ | </ | ||