change behaviour of github_info to fallback sooner to mxcl/master

Fixes Homebrew/homebrew#1980

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
lukas 2010-07-27 17:44:43 +02:00 committed by Adam Vandenberg
parent e2f0e1a26f
commit fd39ff2da6

View File

@ -156,18 +156,17 @@ end
def github_info name def github_info name
formula_name = Formula.path(name).basename formula_name = Formula.path(name).basename
user = '' user = 'mxcl'
branch = '' branch = 'master'
if system "/usr/bin/which -s git" if system "/usr/bin/which -s git"
user=`git config --global github.user`.chomp gh_user=`git config --global github.user 2>/dev/null`.chomp
all_branches = `git branch 2>/dev/null` /^\*\s*(.*)/.match(`git --work-tree=#{HOMEBREW_REPOSITORY} branch 2>/dev/null`)
/^\*\s*(.*)/.match all_branches unless $1.nil? || $1.empty? || gh_user.empty?
branch = ($1 || '').chomp branch = $1.chomp
user = gh_user
end
end end
user = 'mxcl' if user.empty?
branch = 'master' if branch.empty?
return "http://github.com/#{user}/homebrew/commits/#{branch}/Library/Formula/#{formula_name}" return "http://github.com/#{user}/homebrew/commits/#{branch}/Library/Formula/#{formula_name}"
end end