similar logic to http://gerrit.chromium.org/gerrit/#change,10359 Change-Id: Ia12acd2f2b3b92ef2a601da43c2497034ef62174