From 5ba04b0cc6c8d3df935ab3058a91d5cbb5dc5fb7 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 22 Sep 2016 19:26:24 +0100 Subject: [PATCH 1/2] docs: more accurate update-test parameter name `sha1` isn't a very accurate description of what this value can be because it can be any git commit reference. For example, `brew test-bot` uses `brew update-test --commit=HEAD`. --- Library/Homebrew/dev-cmd/update-test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index bcf8020e40..47c9046f23 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -1,9 +1,9 @@ -#: * `update-test` [`--commit=`] [`--before=`] [`--keep-tmp`]: +#: * `update-test` [`--commit=`] [`--before=`] [`--keep-tmp`]: #: Runs a test of `brew update` with a new repository clone. #: #: If no arguments are passed, use `origin/master` as the start commit. #: -#: If `--commit=` is passed, use `` as the start commit. +#: If `--commit=` is passed, use `` as the start commit. #: #: If `--before=` is passed, use the commit at `` as the #: start commit. From b81dcea043e2ce96371af7701f4db39b339434ee Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 22 Sep 2016 19:26:41 +0100 Subject: [PATCH 2/2] update-test: more accurate variable names --- Library/Homebrew/dev-cmd/update-test.rb | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 47c9046f23..18980b691f 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -14,18 +14,18 @@ module Homebrew def update_test cd HOMEBREW_REPOSITORY - start_sha1 = if commit = ARGV.value("commit") + start_commit = if commit = ARGV.value("commit") commit elsif date = ARGV.value("before") Utils.popen_read("git", "rev-list", "-n1", "--before=#{date}", "origin/master").chomp 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 + start_commit = Utils.popen_read("git", "rev-parse", start_commit).chomp + end_commit = Utils.popen_read("git", "rev-parse", "HEAD").chomp - puts "Start commit: #{start_sha1}" - puts "End commit: #{end_sha1}" + puts "Start commit: #{start_commit}" + puts "End commit: #{end_commit}" mktemp("update-test") do |staging| staging.retain! if ARGV.keep_tmp? @@ -39,12 +39,12 @@ module Homebrew safe_system "git", "clone", "--local", "--bare", "#{HOMEBREW_REPOSITORY}/.git", "remote.git" safe_system "git", "config", "remote.origin.url", "#{curdir}/remote.git" - # force push origin to end_sha1 - safe_system "git", "checkout", "-B", "master", end_sha1 + # force push origin to end_commit + safe_system "git", "checkout", "-B", "master", end_commit safe_system "git", "push", "--force", "origin", "master" - # set test copy to start_sha1 - safe_system "git", "reset", "--hard", start_sha1 + # set test copy to start_commit + safe_system "git", "reset", "--hard", start_commit # update ENV["PATH"] ENV["PATH"] = "#{curdir}/bin:/usr/local/bin:/usr/bin:/bin" @@ -52,13 +52,13 @@ 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 start_sha1 != end_sha1 && start_sha1 == actual_end_sha1 + actual_end_commit = Utils.popen_read("git", "rev-parse", "master").chomp + if start_commit != end_commit && start_commit == actual_end_commit raise <<-EOS.undent brew update didn't update master! - Start commit: #{start_sha1} - Expected end commit: #{end_sha1} - Actual end commit: #{actual_end_sha1} + Start commit: #{start_commit} + Expected end commit: #{end_commit} + Actual end commit: #{actual_end_commit} EOS end end