scm: git: support path encoding in adapter diff (#5251).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5039 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
57133f594f
commit
f78339713d
|
@ -253,22 +253,22 @@ module Redmine
|
||||||
|
|
||||||
def diff(path, identifier_from, identifier_to=nil)
|
def diff(path, identifier_from, identifier_to=nil)
|
||||||
path ||= ''
|
path ||= ''
|
||||||
|
cmd_args = []
|
||||||
if identifier_to
|
if identifier_to
|
||||||
cmd = "#{self.class.sq_bin} --git-dir #{target('')} diff --no-color #{shell_quote identifier_to} #{shell_quote identifier_from}"
|
cmd_args << "diff" << "--no-color" << identifier_to << identifier_from
|
||||||
else
|
else
|
||||||
cmd = "#{self.class.sq_bin} --git-dir #{target('')} show --no-color #{shell_quote identifier_from}"
|
cmd_args << "show" << "--no-color" << identifier_from
|
||||||
end
|
end
|
||||||
|
cmd_args << "--" << scm_iconv(@path_encoding, 'UTF-8', path) unless path.empty?
|
||||||
cmd << " -- #{shell_quote path}" unless path.empty?
|
|
||||||
diff = []
|
diff = []
|
||||||
shellout(cmd) do |io|
|
scm_cmd *cmd_args do |io|
|
||||||
io.each_line do |line|
|
io.each_line do |line|
|
||||||
diff << line
|
diff << line
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil if $? && $?.exitstatus != 0
|
|
||||||
diff
|
diff
|
||||||
|
rescue ScmCommandAborted
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def annotate(path, identifier=nil)
|
def annotate(path, identifier=nil)
|
||||||
|
|
Loading…
Reference in New Issue