rosa-build/lib/grit/repo.rb

18 lines
407 B
Ruby
Raw Normal View History

2012-02-01 18:33:53 +00:00
# -*- encoding : utf-8 -*-
module Grit
class Repo
def diff_with_encoding(a, b, *paths)
diff = self.git.native('diff', {}, a, b, '--', *paths).encode_to_default
2012-02-01 18:33:53 +00:00
if diff =~ /diff --git "{0,1}a/
diff = diff.sub(/.*?(diff --git "{0,1}a)/m, '\1')
else
diff = ''
end
Diff.list_from_string(self, diff)
end
alias_method_chain :diff, :encoding
2012-02-01 18:33:53 +00:00
end
end