aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd
diff options
context:
space:
mode:
authorMike McQuaid2017-03-28 15:31:16 +0100
committerMike McQuaid2017-03-28 15:31:16 +0100
commitc3bf9bda58aba514259d45972a5172e8801d5c65 (patch)
treedce24ba112271c8d38434ff60dd98b0ad516cfde /Library/Homebrew/dev-cmd
parent676c4a9e33672cd6035ef9225f5d3f9e9d63f810 (diff)
downloadbrew-c3bf9bda58aba514259d45972a5172e8801d5c65.tar.bz2
update-test: improve error handling.
Fail if the start or end commit are missing and retry finding the previous tag by fetching all tags if they are missing. This should fix CI on the current Homebrew/brew `master` branch. Closes #2404.
Diffstat (limited to 'Library/Homebrew/dev-cmd')
-rw-r--r--Library/Homebrew/dev-cmd/update-test.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb
index 2ff168669..3cf095f2b 100644
--- a/Library/Homebrew/dev-cmd/update-test.rb
+++ b/Library/Homebrew/dev-cmd/update-test.rb
@@ -33,12 +33,24 @@ module Homebrew
elsif date = ARGV.value("before")
Utils.popen_read("git", "rev-list", "-n1", "--before=#{date}", "origin/master").chomp
elsif ARGV.include?("--to-tag")
- Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1].chomp
+ previous_tag =
+ Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1]
+ unless previous_tag
+ safe_system "git", "fetch", "--tags"
+ previous_tag =
+ Utils.popen_read("git", "tag", "--list", "--sort=-version:refname").lines[1]
+ end
+ previous_tag.to_s.chomp
else
Utils.popen_read("git", "rev-parse", "origin/master").chomp
end
+ odie "Could not find start commit!" if start_commit.empty?
+
start_commit = Utils.popen_read("git", "rev-parse", start_commit).chomp
+ odie "Could not find start commit!" if start_commit.empty?
+
end_commit = Utils.popen_read("git", "rev-parse", "HEAD").chomp
+ odie "Could not find end commit!" if end_commit.empty?
puts "Start commit: #{start_commit}"
puts "End commit: #{end_commit}"