lib/dandelion/git.rb in dandelion-0.2.1 vs lib/dandelion/git.rb in dandelion-0.2.2

- old
+ new

@@ -18,11 +18,11 @@ def initialize(repo, from_revision, to_revision) @repo = repo @from_revision = from_revision @to_revision = to_revision begin - @files = parse_diff @repo.git.native(:diff, {:name_status => true, :raise => true}, from_revision, to_revision) + @files = parse(diff) rescue Grit::Git::CommandFailed raise DiffError end end @@ -33,11 +33,15 @@ def deleted @files.to_a.select { |f| 'D' == f.last }.map { |f| f.first } end private + + def diff + @repo.git.native(:diff, {:name_status => true, :raise => true}, from_revision, to_revision) + end - def parse_diff(diff) + def parse(diff) files = {} diff.split("\n").each do |line| status, file = line.split("\t") files[file] = status end \ No newline at end of file