Created
March 6, 2012 07:06
-
-
Save terotil/1984500 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Repo | |
def initialize(path) | |
@path = path | |
end | |
def commits | |
@commits ||= log. | |
gsub(/\t/, " "). # remove tabs | |
split('$$'). # split by marker | |
select { |commit| commit != "" }. # only consider non-empty | |
map { |commit| Commit.new(commit) } # instantiate commits | |
end | |
def log | |
@log ||= Dir.chdir(@path) do | |
`git log --format='$$^^%h^^%ct^^%B' --numstat` | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment