summaryrefslogtreecommitdiffstats
path: root/lib/git/base.rb
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-19 14:32:53 -0800
committerscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-19 14:32:53 -0800
commit7dc56e180632790d04a3c2dfd526e8bced746c94 (patch)
tree6e5fc39a769635ade48bda42b3d934252178d655 /lib/git/base.rb
parentc478613ee08ead9319262e325cd02040a8adac22 (diff)
downloadthird_party-ruby-git-7dc56e180632790d04a3c2dfd526e8bced746c94.tar.gz
third_party-ruby-git-7dc56e180632790d04a3c2dfd526e8bced746c94.tar.xz
third_party-ruby-git-7dc56e180632790d04a3c2dfd526e8bced746c94.zip
added some TODO notes, the History.txt entry i forgot and a way to attach a custom logger to Git
Diffstat (limited to 'lib/git/base.rb')
-rw-r--r--lib/git/base.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/git/base.rb b/lib/git/base.rb
index 2986864..fe0b2e7 100644
--- a/lib/git/base.rb
+++ b/lib/git/base.rb
@@ -7,10 +7,14 @@ module Git
@index = nil
@lib = nil
+ @logger = nil
# opens a bare Git Repository - no working directory options
- def self.bare(git_dir)
- self.new :repository => git_dir
+ def self.bare(git_dir, opts = {})
+ default = {:repository => git_dir}
+ git_options = default.merge(opts)
+
+ self.new(git_options)
end
# opens a new Git Project from a working directory
@@ -67,6 +71,9 @@ module Git
options[:repository] = File.join(working_dir, '.git') if !options[:repository]
options[:index] = File.join(working_dir, '.git', 'index') if !options[:index]
end
+ if options[:log]
+ @logger = options[:log]
+ end
@working_directory = Git::WorkingDirectory.new(options[:working_directory]) if options[:working_directory]
@repository = Git::Repository.new(options[:repository]) if options[:repository]
@@ -199,7 +206,7 @@ module Git
# actual 'git' forked system calls. At some point I hope to replace the Git::Lib
# class with one that uses native methods or libgit C bindings
def lib
- @lib ||= Git::Lib.new(self)
+ @lib ||= Git::Lib.new(self, @logger)
end
# will run a grep for 'string' on the HEAD of the git repository