Fixed reading branch name

The git command now uses --git-dir instead of --work-tree.
Using --work-tree won't work if you are inside another Git repository.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
Sebastian Staudt 2011-03-29 21:58:16 +02:00 committed by Adam Vandenberg
parent e08ef940be
commit be482fb9ab

View File

@ -25,7 +25,7 @@ module Homebrew extend self
if system "/usr/bin/which -s git"
gh_user=`git config --global github.user 2>/dev/null`.chomp
/^\*\s*(.*)/.match(`git --work-tree=#{HOMEBREW_REPOSITORY} branch 2>/dev/null`)
/^\*\s*(.*)/.match(`git --git-dir=#{HOMEBREW_REPOSITORY}/.git branch 2>/dev/null`)
unless $1.nil? || $1.empty? || gh_user.empty?
branch = $1.chomp
user = gh_user