diff --git a/lib/git/base.rb b/lib/git/base.rb index e5e5b3e5..9833427a 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -165,6 +165,11 @@ def gblob(objectish) Git::Object.new(self, objectish, 'blob') end + # returns files affected by a commit + def show_filenames(sha) + self.lib.show_filenames(sha) + end + # returns a Git::Log object with count commits def log(count = 30) Git::Log.new(self, count) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index ed4ef1a8..b293737f 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -216,6 +216,10 @@ def branch_current branches_all.select { |b| b[1] }.first[0] rescue nil end + def show_filenames(sha) + arr = [] + command_lines('show', ['--pretty="format:"', '--name-only', sha]) + end # returns hash # [tree-ish] = [[line_no, match], [line_no, match2]]