Skip to content

Commit

Permalink
allow non-bare repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Hoeksema committed Dec 16, 2009
1 parent 1f21d8f commit 51147ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/grit/git-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ module GitRuby
attr_accessor :ruby_git_repo, :git_file_index

def init(options = {})
if options.size == 0
Grit::GitRuby::Repository.init(@git_dir)
bare = options.has_key?(:bare) ? options[:bare] : true

if options.size == 0 || (options.size == 1 && options.has_key?(:bare))
Grit::GitRuby::Repository.init(@git_dir, bare)
else
method_missing('init', options)
end
Expand Down
10 changes: 9 additions & 1 deletion lib/grit/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ def self.init(path, options = {})

git = Git.new(path, working_dir)

git.init
if options.has_key?(:bare)
bare = options[:bare]
elsif options.has_key?(:is_bare)
bare = options[:is_bare]
else
bare = true
end

git.init(:bare => bare)

Repo.new(path)
end
Expand Down

0 comments on commit 51147ac

Please sign in to comment.