From fd39ff2da672b12b4d1e55b8a1d00d1a3e63e00c Mon Sep 17 00:00:00 2001 From: lukas Date: Tue, 27 Jul 2010 17:44:43 +0200 Subject: [PATCH] change behaviour of github_info to fallback sooner to mxcl/master Fixes Homebrew/homebrew#1980 Signed-off-by: Adam Vandenberg --- Library/Homebrew/brew.h.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index 1853471236..ba3c15f05d 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -156,18 +156,17 @@ end def github_info name formula_name = Formula.path(name).basename - user = '' - branch = '' + user = 'mxcl' + branch = 'master' if system "/usr/bin/which -s git" - user=`git config --global github.user`.chomp - all_branches = `git branch 2>/dev/null` - /^\*\s*(.*)/.match all_branches - branch = ($1 || '').chomp + gh_user=`git config --global github.user 2>/dev/null`.chomp + /^\*\s*(.*)/.match(`git --work-tree=#{HOMEBREW_REPOSITORY} branch 2>/dev/null`) + unless $1.nil? || $1.empty? || gh_user.empty? + branch = $1.chomp + user = gh_user + end end - - user = 'mxcl' if user.empty? - branch = 'master' if branch.empty? return "http://github.com/#{user}/homebrew/commits/#{branch}/Library/Formula/#{formula_name}" end