Hi folks!
I'm processing a git repository and i need to know what files were
added/deleted/modified during the latest commits.
The following works for me, but I wondered if there's a better
approach when using Grit..
repo = Grit::Repo.new("mypath")
stats = repo.git.sh("git diff HEAD^ HEAD --name-status")
"stats".split("\n").each do |line|
mode, filename = line.split("\t")
case mode
when "A"
puts "adde #{filename}"
when "D"
puts "dele #{filename}"
when "M"
puts "modi #{filename}"
else
# NOOP
end
end
Any hints appreciated :)
--dpree
--
You received this message because you are subscribed to the Google Groups
"GitHub" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/github?hl=en.