I try to get the commits that have been done after a date in a local copy of a git repo and then extract the related modifications on the files.
If I would like to compare this to a git command, It would be :
git log -p --reverse --after="2016-10-01"
Here is the script I use:
require "rugged"
require "date"
git_dir = "../ruby-gnome2/"
repo = Rugged::Repository.new(git_dir)
walker = Rugged::Walker.new(repo)
walker.sorting(Rugged::SORT_DATE| Rugged::SORT_REVERSE)
walker.push(repo.head.target)
walker.each do |commit|
c_time = Time.at(commit.time)
next unless c_time >= Date.new(2016,10,01).to_time
puts c_time
puts commit.diff.size
puts commit.diff.stat.inspect
end
The problem is that it looks like a lot of files are modified here is the end of the output of this script:
2016-10-22 17:33:37 +0200
2463
[2463, 0, 271332]
Which means that there are 2463 files modified/deleted/replaced. While a git log -p --reverse --after="2016-10-22"
show that only 2 files are modified.
How can I get the same results than with the git command? ie How can I find the real files that are modified by this commit?