1

Using the Rugged gem, I want to obtain all commits in all branches, similar to this git command line:

$ git log --all

Walker requires a branch, so the following only works for the specified branch:

repo = Rugged::Repository.new(working_dir)
walker = Rugged::Walker.new(repo)
walker.sorting(Rugged::SORT_DATE)
walker.push(repo.branches['master'].target_id)
walker.each do |commit|
  # do stuff
end

walker.push seems to be a requirement for walker to return a value, but I do not want to filter out any branches.

Mike Slinn
  • 7,705
  • 5
  • 51
  • 85

0 Answers0