aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-06-02 13:01:02 +0100
committerMike McQuaid2013-06-02 13:01:02 +0100
commit353430983502424ee540f6a804900995fcfcbebc (patch)
tree966af87c429b99a459f464923d16e3494905c2ad /Library
parent9d401d5c0e1e3e33be02d5d1e690a07c9bd4e874 (diff)
downloadhomebrew-353430983502424ee540f6a804900995fcfcbebc.tar.bz2
brew-test-bot: better name hash and url builds.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/cmd/brew-test-bot.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/Library/Contributions/cmd/brew-test-bot.rb b/Library/Contributions/cmd/brew-test-bot.rb
index caee05395..1d8ae1472 100755
--- a/Library/Contributions/cmd/brew-test-bot.rb
+++ b/Library/Contributions/cmd/brew-test-bot.rb
@@ -145,6 +145,10 @@ class Test
git('symbolic-ref HEAD').gsub('refs/heads/', '').strip
end
+ def single_commit? start_revision, end_revision
+ git("rev-list --count #{start_revision}..#{end_revision}").to_i == 1
+ end
+
@category = __method__
@start_branch = current_branch
@@ -160,7 +164,8 @@ class Test
end
if @hash == 'HEAD'
- if diff_start_sha1 == diff_end_sha1
+ if diff_start_sha1 == diff_end_sha1 or \
+ single_commit?(diff_start_sha1, diff_end_sha1)
@name = diff_end_sha1
else
@name = "#{diff_start_sha1}-#{diff_end_sha1}"
@@ -174,7 +179,14 @@ class Test
test "git checkout #{current_sha1}"
test "brew pull --clean #{@url}"
diff_end_sha1 = current_sha1
- @name = "#{@url}-#{diff_end_sha1}"
+ @short_url = @url.gsub('https://github.com/', '')
+ if @short_url.include? '/commit/'
+ # 7 characters should be enough for a commit (not 40).
+ @short_url.gsub!(/(commit\/\w{7}).*/, '\1')
+ @name = @short_url
+ else
+ @name = "#{@short_url}-#{diff_end_sha1}"
+ end
else
diff_start_sha1 = diff_end_sha1 = current_sha1
@name = "#{@formulae.first}-#{diff_end_sha1}"