From b9d5b11f321a359b462aa2c353c2bdb483930fb3 Mon Sep 17 00:00:00 2001
From: Mike McQuaid <mike@mikemcquaid.com>
Date: Thu, 11 Aug 2016 11:24:03 +0100
Subject: [PATCH] update-test: check we end up at end commit.

This would have caught the bug fixed in 985c67.
---
 Library/Homebrew/dev-cmd/update-test.rb | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb
index 621c41526e..84de08a7fb 100644
--- a/Library/Homebrew/dev-cmd/update-test.rb
+++ b/Library/Homebrew/dev-cmd/update-test.rb
@@ -16,6 +16,7 @@ module Homebrew
     else
       Utils.popen_read("git", "rev-parse", "origin/master").chomp
      end
+    start_sha1 = Utils.popen_read("git", "rev-parse", start_sha1).chomp
     end_sha1 = Utils.popen_read("git", "rev-parse", "HEAD").chomp
 
     puts "Start commit: #{start_sha1}"
@@ -47,6 +48,15 @@ module Homebrew
       # run brew update
       oh1 "Running brew update..."
       safe_system "brew", "update", "--verbose"
+      actual_end_sha1 = Utils.popen_read("git", "rev-parse", "master").chomp
+      if actual_end_sha1 != end_sha1
+        raise <<-EOS.undent
+          brew update didn't update master!
+          Start commit:        #{start_sha1}
+          Expected end commit: #{end_sha1}
+          Actual end commit:   #{actual_end_sha1}
+        EOS
+      end
     end
   end
 end
-- 
GitLab