diff options
author | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-19 14:32:53 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-19 14:32:53 -0800 |
commit | 7dc56e180632790d04a3c2dfd526e8bced746c94 (patch) | |
tree | 6e5fc39a769635ade48bda42b3d934252178d655 /lib/git/lib.rb | |
parent | c478613ee08ead9319262e325cd02040a8adac22 (diff) | |
download | third_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/lib.rb')
-rw-r--r-- | lib/git/lib.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/git/lib.rb b/lib/git/lib.rb index c6d3580..293e00b 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -11,8 +11,10 @@ module Git @git_index_file = nil @git_work_dir = nil @path = nil - - def initialize(base = nil) + + @logger = nil + + def initialize(base = nil, logger = nil) if base.is_a?(Git::Base) @git_dir = base.repo.path @git_index_file = base.index.path if base.index @@ -22,6 +24,9 @@ module Git @git_index_file = base[:index] @git_work_dir = base[:working_directory] end + if logger + @logger = logger + end end def init @@ -481,10 +486,11 @@ module Git out = `git #{cmd} #{opts} 2>&1`.chomp end - #puts git_cmd - #puts out - #puts - + if @logger + @logger.info(git_cmd) + @logger.debug(out) + end + if $?.exitstatus > 0 if $?.exitstatus == 1 && out == '' return '' |