summaryrefslogtreecommitdiffstats
path: root/lib/git/lib.rb
blob: 3df049c51ca89df95d58ecccfc710ee7d8ac70e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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