Skip to content
Snippets Groups Projects
Commit 4f3d1f02 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

brew-test-bot: better name hash and url builds.

parent bec7ff98
No related branches found
No related tags found
No related merge requests found
......@@ -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}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment