Skip to content

Instantly share code, notes, and snippets.

@terotil
Created March 6, 2012 07:06
Show Gist options
  • Save terotil/1984500 to your computer and use it in GitHub Desktop.
Save terotil/1984500 to your computer and use it in GitHub Desktop.
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