From 2a2059095c8b6827a9e55c6bb46beac71bc53758 Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso Date: Mon, 23 Apr 2012 16:12:17 +0200 Subject: [PATCH] Added show_filenames --- lib/git/base.rb | 5 +++++ lib/git/lib.rb | 4 ++++ 2 files changed, 9 insertions(+) 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]]