A Drupal 8 git bisect exercise

git-bisect.png
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
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 ...
The development site was synchronised using the usual drush commands
drush rsync @drupal.tst:%files @drupal.dev:%files
drush sql-sync @drupal.tst @drupal.dev

Test site

So where's the test site standing?
$git log -n 1
commit e99a83e54d99cb5111585a37b954b62886b7c65b
Author: Alex Pott <alex.a.pott@googlemail.com>
Date:   Fri May 31 11:16:37 2013 +0100
So we are 12 days behind.

Dev site

Let's check what happened and can we fix it?
$ git pull
$ git log --oneline  e99a83e54d99cb5111585a37b954b62886b7c65b.. | wc -l
     235
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 bisect start
$ git bisect good e99a83e54d99cb5111585a37b954b62886b7c65b
Now git takes the middle between HEAD and the good version. Checking the front page now shows it's
$ 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
Hmmm ... I made a mistake. That version is probably good enough.
$ git bisect good 3fdf6a1c139fd2a36ff8bf12f1b29f31bced8973
You need to start by "git bisect start"
-n Do you want me to do it for you [Y/n]?
So this continues for a while
  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
Now the site is working and no more bisect commits left.
$ git log -n 1
commit 9d73599020c282ed79294dcb4121212bb03b782c
Author: Alex Pott <alex.a.pott@googlemail.com>
Date:   Thu Jun 6 09:08:39 2013 +0100

    Issue #2001310 by chx, effulgentsia, Berdir, YesCT: Disallow firing hooks during update.
So the current commit is OK. What happened with the next one?
$ git log origin/8.x
# now search for the good commit 9d73599020c282ed79294dcb4121212bb03b782c
# this is the bad one?
commit b21943922d94261dfa8de34995d206d5e8e9c3d7
Author: Alex Pott <alex.a.pott@googlemail.com>
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.
Well that matches with the error. And the diff shows an interesting change on the core.services.yml
git checkout b21943922d94261dfa8de34995d206d5e8e9c3d7
git show
Now the puzzle is to solve this upgrade path.