Skip to content

Instantly share code, notes, and snippets.

@schacon
Created July 19, 2011 15:48
Show Gist options
  • Save schacon/1092843 to your computer and use it in GitHub Desktop.
Save schacon/1092843 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
$LOAD_PATH.unshift '/Users/schacon/projects/git/rugged/lib'
require 'rugged'
require 'rubygems'
require 'pp'
dir, id = "/opt/linux.git"
repo = Rugged::Repository.new(dir)
walker = Rugged::Walker.new(repo)
Rugged::Reference.each(repo) do |r|
ref = Rugged::Reference.lookup(repo, r)
begin
walker.push(ref.target)
rescue
nil
end
end
walker.each do |commit|
counter += 1
end
puts counter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment