Index: tools/gn/bin/roll_gn.py |
diff --git a/tools/gn/bin/roll_gn.py b/tools/gn/bin/roll_gn.py |
index 1e9dec9e79d594fa0c6410dad55fe602e5cf5680..ae9489fde0cab87451f0c482ffee160c9787e29b 100644 |
--- a/tools/gn/bin/roll_gn.py |
+++ b/tools/gn/bin/roll_gn.py |
@@ -376,8 +376,11 @@ class GNRoller(object): |
return 0 |
def MovetoLastHead(self): |
- _, out, _ = self.Call('git reflog -1') |
- m = re.match('moving from ([^\s]+)', out) |
+ # When this is called, there will be a commit + a checkout as |
+ # the two most recent entries in the reflog, assuming nothing as |
+ # modified the repo while this script has been running. |
+ _, out, _ = self.Call('git reflog -2') |
+ m = re.search('moving from ([^\s]+)', out) |
last_head = m.group(1) |
self.Call('git checkout %s' % last_head) |