summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--History.txt5
-rw-r--r--TODO2
-rw-r--r--benchmark.rb4
-rw-r--r--camping/gitweb.rb3
-rw-r--r--lib/git.rb4
-rw-r--r--lib/git/base.rb13
-rw-r--r--lib/git/lib.rb18
7 files changed, 35 insertions, 14 deletions
diff --git a/History.txt b/History.txt
index b7b7bc3..4177956 100644
--- a/History.txt
+++ b/History.txt
@@ -1,3 +1,8 @@
+== 1.0.4
+
+* added camping/gitweb.rb frontend
+* added a number of speed-ups
+
== 1.0.3
* Sped up most of the operations
diff --git a/TODO b/TODO
index dc8cde5..3394996 100644
--- a/TODO
+++ b/TODO
@@ -15,7 +15,7 @@
- prune, fsck, pack-refs, gc, count-objects, unpack-objects
* email/patch integration
- - request-pull(email_address), git-am, git-apply
+ - request-pull(email_address), git-am, git-apply, cherry-pick
* compatible with git 1.4
diff --git a/benchmark.rb b/benchmark.rb
index e5a8953..022e4ee 100644
--- a/benchmark.rb
+++ b/benchmark.rb
@@ -2,8 +2,8 @@ require 'fileutils'
require 'benchmark'
require 'rubygems'
require 'ruby-prof'
-require_gem 'git', '1.0.3'
-#require 'lib/git'
+#require_gem 'git', '1.0.3'
+require 'lib/git'
def main
@wbare = File.expand_path(File.join('tests', 'files', 'working.git'))
diff --git a/camping/gitweb.rb b/camping/gitweb.rb
index bae922a..4b6ffd4 100644
--- a/camping/gitweb.rb
+++ b/camping/gitweb.rb
@@ -12,6 +12,9 @@ require 'lib/git'
#
# todo
# - diff/patch between any two objects
+# - prettify : http://projects.wh.techno-weenie.net/changesets/3030
+# - add user model (add/remove repos)
+# - implement http-push for authenticated users
#
# author : scott chacon
#
diff --git a/lib/git.rb b/lib/git.rb
index 7c13d1a..02a3b8a 100644
--- a/lib/git.rb
+++ b/lib/git.rb
@@ -48,8 +48,8 @@ module Git
# it expects not to be able to use a working directory
# so you can't checkout stuff, commit things, etc.
# but you can do most read operations
- def self.bare(git_dir)
- Base.bare(git_dir)
+ def self.bare(git_dir, options = {})
+ Base.bare(git_dir, options)
end
# open an existing git working directory
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
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 ''