summaryrefslogtreecommitdiffstats
path: root/lib/git/lib.rb
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-08 11:22:46 -0800
committerscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-08 11:22:46 -0800
commitb18bca3b853dee6a7bc86f09921aa3b1ee3f3d7b (patch)
tree718f1b6451f5a9dd9b8cb844fa3d3e9f32400d50 /lib/git/lib.rb
parent169381bbce998807c119f291d69b8ae1d8fb5785 (diff)
downloadthird_party-ruby-git-b18bca3b853dee6a7bc86f09921aa3b1ee3f3d7b.tar.gz
third_party-ruby-git-b18bca3b853dee6a7bc86f09921aa3b1ee3f3d7b.tar.xz
third_party-ruby-git-b18bca3b853dee6a7bc86f09921aa3b1ee3f3d7b.zip
added log functions
Diffstat (limited to 'lib/git/lib.rb')
-rw-r--r--lib/git/lib.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/git/lib.rb b/lib/git/lib.rb
new file mode 100644
index 0000000..3df049c
--- /dev/null
+++ b/lib/git/lib.rb
@@ -0,0 +1,22 @@
+module Git
+ class Lib
+
+ @base = nil
+
+ def initialize(base)
+ @base = base
+ end
+
+ def log_shas(count)
+ command('log', "-#{count} --pretty=oneline").split("\n").map { |l| Git::Commit.new(l.split.first) }
+ end
+
+ private
+
+ def command(cmd, opts)
+ ENV['GIT_DIR'] = @base.repo.path
+ `git #{cmd} #{opts}`
+ end
+
+ end
+end \ No newline at end of file