I want a list of files affected by a certain commit in git. Through the command line, I can do this with:
git show --pretty="format:" --name-only (sha)
But how can I do this through Grit in Ruby?
I want a list of files affected by a certain commit in git. Through the command line, I can do this with:
git show --pretty="format:" --name-only (sha)
But how can I do this through Grit in Ruby?
You can use
your_commit.diffs
which returns an array ofGrit::Diff
instances.Grit::Diff
hasa_path
andb_path
properties.Some (untested) example code:
Since Grit's git module employs method_missing to shell out, you can also try:
grit.git.show({ :pretty => :format, :name_only => true}, sha)