By Alessandro Lai / @AlessandroLai
Nomad PHP Lightining talk - 18 august 2016
From the Git documentation:
This command uses a binary search algorithm to find which commit in your project’s history introduced a bug.
But what is a binary search algorithm?
It searches for a value inside an ordered list/array
Easy example:
we are searching for number 4
inside the [1...9] interval
|
||||||||
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|
|
|||||||
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|
|
|||||||
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
With git bisect
:
facile-it/paraunit
I use Paraunit in 2 different projects:
Note: the 2.8 version in the bridge between 2.7 and 3.0,
so they receive the same patches
A few months ago,
I was upgrading to the latest available patch...
2.8.3 2.8.4
3.0.3 3.0.4
$ rm -rf vendor/symfony/symfony
$ composer install --prefer-source
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing symfony/symfony (v2.8.9)
Cloning df02dd5d3f7decb3a05c6d0f31054b4263625dcb
[...]
$ cd vendor/symfony/symfony
$ git status
HEAD detached at v2.8.9
nothing to commit, working directory clean
$ git bisect start
$ git checkout v2.8.3
Previous HEAD position was df02dd5... Merge pull request #19487 from fabpot/release-2.8.9
HEAD is now at 7a9a5fc... Merge pull request #17952 from fabpot/release-2.8.3
$ git bisect good
$ git checkout v2.8.4
Previous HEAD position was 7a9a5fc... Merge pull request #17952 from fabpot/release-2.8.3
HEAD is now at 9e14f9f... Merge branch '2.7' into 2.8
$ git bisect bad
Bisecting: 154 revisions left to test after this (roughly 7 steps)
[ff93c1a0266d766c0643c6fd862b00fe0e4dd54e] bug #18087 [WebProfiler] Sidebar button padding (rvanlaak)
$ git bisect bad
Bisecting: 37 revisions left to test after this (roughly 5 steps)
[4fece2877337b182927331a728a3bed90f9fb394] bug #18175 [Translation] Add support for fuzzy tags in PoFileLoader (nud)
$ git bisect bad
b2293515a491db91e8ee85178558461374161a77 is the first bad commit
commit b2293515a491db91e8ee85178558461374161a77
Author: Nicolas Grekas <nicolas.grekas@gmail.com>
Date: Wed Mar 16 16:22:42 2016 +0100
[PhpUnitBridge] Revert 7f62133939b1172e1c9924d211e1d315230b3be8
:040000 040000 4cf2abdee62e5708f91a8025e81a1fad5a91e154 182f7ddb10abb302c077a8a248cf285fd1a43c2e M src
good
and bad
,old
and new
!
git bisect terms
to get a reminder
$ git bisect start --term-old fast --term-new slow
$ git checkout baf35cf3c0e09a2de186e135cfcc001956a923f0
$ git bisect bad
Bisecting: 2 revisions left to test after this (roughly 1 step)
[478c49a8aae66c4701ccd8fcba979cb17c038327] update CONTRIBUTORS for 2.3.38
$ git bisect skip
Bisecting: 37 revisions left to test after this (roughly 5 steps)
[2a2aefa4b7c3ee573f0d11b36ce4411787b95180] minor #18119 [Hack Day] Issue for newcomers (2). Replace perfom by perform (JuanLuisGarciaBorrego)
$ git bisect skip
There are only 'skip'ped commits left to test.
The first bad commit could be any of:
478c49a8aae66c4701ccd8fcba979cb17c038327
84203be72071a16aa8e552b88effc63d64abab62
78f4e00140b9925eb83df48e19e33642b7a25db9
c51503db3f4e8f22a075cc9a226cfe7c42a7663e
baf35cf3c0e09a2de186e135cfcc001956a923f0
We cannot bisect more!
Thank you for your attention!
Please rate my talk on Joind.in!