I am having trouble trying to find out what files changed between two different commits. Here is the setup, version of Ruby and the Gem Grit, and what happens when I run the program:
> cd /temp
> mkdir tt
> cd tt
> git init
Initialized empty Git repository in C:/temp/tt/.git/
> ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
> gem list grit
*** LOCAL GEMS ***
grit (2.0.0)
> ruby ..\git_diff_test.rb
Commit #1 succeeded.
Commit #2 succeeded.
c:/apps/ruby/lib/ruby/gems/1.8/gems/grit-2.0.0/lib/grit/repo.rb:290:in `diff': wrong number of arguments (4 for 3) (ArgumentError)
from c:/apps/ruby/lib/ruby/gems/1.8/gems/grit-2.0.0/lib/grit/repo.rb:290:in `diff'
from ../git_diff_test.rb:13
Here is the ruby program:
require 'rubygems'
require 'grit'
include Grit
File.open('t1.txt', 'w') { |f| f.write('hi/bye') }
repo = Repo.new('.')
repo.add('.')
puts "Commit #1 #{repo.commit_all('1') ? 'succeeded' : 'failed'}."
File.open('t1.txt', 'w') { |f| f.write('hi/bye twice') }
File.open('t2.txt', 'w') { |f| f.write('hi/bye 2') }
repo.add('.')
puts "Commit #2 #{repo.commit_all('2') ? 'succeeded' : 'failed'}."
commits = repo.commits
the_diff = repo.diff(commits[0], commits[1]) # line 13 with the error
p the_diff