From: Toshi MARUYAMA Date: Tue, 8 Mar 2011 04:50:28 +0000 (+0000) Subject: scm: git: support path encoding in adapter diff (#5251). X-Git-Tag: 1.2.0~803 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5086bc4383443ee66d2362b3ed3bc735ed04bf42;p=redmine.git 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 --- diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index a90336c75..4b12126f0 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -227,7 +227,7 @@ module Redmine elsif (parsing_descr == 1) changeset[:description] << line[4..-1] end - end + end if changeset[:commit] revision = Revision.new({ @@ -253,22 +253,22 @@ module Redmine def diff(path, identifier_from, identifier_to=nil) path ||= '' - + cmd_args = [] 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 - cmd = "#{self.class.sq_bin} --git-dir #{target('')} show --no-color #{shell_quote identifier_from}" + cmd_args << "show" << "--no-color" << identifier_from end - - cmd << " -- #{shell_quote path}" unless path.empty? + cmd_args << "--" << scm_iconv(@path_encoding, 'UTF-8', path) unless path.empty? diff = [] - shellout(cmd) do |io| + scm_cmd *cmd_args do |io| io.each_line do |line| diff << line end end - return nil if $? && $?.exitstatus != 0 diff + rescue ScmCommandAborted + nil end def annotate(path, identifier=nil)