2012-02-01 18:33:53 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
|
|
|
module Grit
|
|
|
|
class Repo
|
|
|
|
|
2012-02-13 23:29:33 +00:00
|
|
|
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
|
2012-02-13 23:29:33 +00:00
|
|
|
alias_method_chain :diff, :encoding
|
2012-02-01 18:33:53 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|