A Drupal 8 git bisect exercise
Submitted by clemens on Wed, 2013/06/12 - 10:38am
Having a Drupal 8 site under development with a customer aware of the risk of loosing data I took the risk of fixing a broken Drupal 8 site. Today I did an code update and got the following welcome screen on http://drupal.dev
The development site was synchronised using the usual drush commands
If you have just changed code (for example deployed a new module or moved an existing one) read http://drupal.org/documentation/rebuild Additional uncaught exception thrown while handling exception. Original Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "url_generator". in ...
drush rsync @drupal.tst:%files @drupal.dev:%files drush sql-sync @drupal.tst @drupal.dev
Test siteSo where's the test site standing?
So we are 12 days behind.
$git log -n 1 commit e99a83e54d99cb5111585a37b954b62886b7c65b Author: Alex Pott <firstname.lastname@example.org> Date: Fri May 31 11:16:37 2013 +0100
Dev siteLet's check what happened and can we fix it?
Wow ... 12 days 235 commits ... that's too much. We know it worked once so let's start with that good version. First we tell git we want to find code where it went wrong and which version was right.
$ git pull $ git log --oneline e99a83e54d99cb5111585a37b954b62886b7c65b.. | wc -l 235
Now git takes the middle between HEAD and the good version. Checking the front page now shows it's
$ git bisect start $ git bisect good e99a83e54d99cb5111585a37b954b62886b7c65b
Hmmm ... I made a mistake. That version is probably good enough.
$ git bisect bad # check front page again $ git bisect bad # now my site is alive a little (menu doesn't look good enough) $ drush cc all # still not good enough
So this continues for a while
$ git bisect good 3fdf6a1c139fd2a36ff8bf12f1b29f31bced8973 You need to start by "git bisect start" -n Do you want me to do it for you [Y/n]?
Now the site is working and no more bisect commits left.
583 git bisect bad 584 git bisect bad 585 git bisect good 586 git bisect good 587 git bisect bad 588 git bisect good 589 git bisect bad 590 git bisect bad
So the current commit is OK. What happened with the next one?
$ git log -n 1 commit 9d73599020c282ed79294dcb4121212bb03b782c Author: Alex Pott <email@example.com> Date: Thu Jun 6 09:08:39 2013 +0100 Issue #2001310 by chx, effulgentsia, Berdir, YesCT: Disallow firing hooks during update.
Well that matches with the error. And the diff shows an interesting change on the core.services.yml
$ git log origin/8.x # now search for the good commit 9d73599020c282ed79294dcb4121212bb03b782c # this is the bad one? commit b21943922d94261dfa8de34995d206d5e8e9c3d7 Author: Alex Pott <firstname.lastname@example.org> Date: Thu Jun 6 09:14:16 2013 +0100 Issue #1888424 by katbailey, steveoliver, twistor, beejeebus, effulgentsia: Change notice: Make Drupal's URL generation logic available to HttpKernel, and minimize code repetition/divergence.
Now the puzzle is to solve this upgrade path.
git checkout b21943922d94261dfa8de34995d206d5e8e9c3d7 git show