Implement github pipeline req of current-patchset

Require that the commit from the event is the latest commit in the pull
request.

Also fix a problem with faked github status grabs. Now we're sending an
event where the sha of the event isn't the head sha, and that was
tripping up our fakes.

Change-Id: I269c97d096e42f0a2d4a0f1b0e57eb238e0b7baf
diff --git a/tests/unit/test_github_requirements.py b/tests/unit/test_github_requirements.py
index 3c77ff2..5dd6e80 100644
--- a/tests/unit/test_github_requirements.py
+++ b/tests/unit/test_github_requirements.py
@@ -307,3 +307,22 @@
         self.waitUntilSettled()
         # PR is closed, should not trigger
         self.assertEqual(len(self.history), 1)
+
+    @simple_layout('layouts/requirements-github.yaml', driver='github')
+    def test_require_current(self):
+
+        A = self.fake_github.openFakePullRequest('org/project9', 'master', 'A')
+        # A sync event that we will keep submitting to trigger
+        sync = A.getPullRequestSynchronizeEvent()
+        self.fake_github.emitEvent(sync)
+        self.waitUntilSettled()
+
+        # PR head is current should enqueue
+        self.assertEqual(len(self.history), 1)
+
+        # Add a commit to the PR, re-issue the original comment event
+        A.addCommit()
+        self.fake_github.emitEvent(sync)
+        self.waitUntilSettled()
+        # Event hash is not current, should not trigger
+        self.assertEqual(len(self.history), 1)