summaryrefslogtreecommitdiffstats
path: root/lib/redmine/scm/adapters
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-03-08 05:17:22 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-03-08 05:17:22 +0000
commitc809c0c49815259a9b75fb3abc3fcfb2782efebd (patch)
tree348cbf6517f42691d215b9c78378f739588aa3eb /lib/redmine/scm/adapters
parentc4b84ec5104e9f5bf034af9008ce7e1783639f13 (diff)
downloadredmine-c809c0c49815259a9b75fb3abc3fcfb2782efebd.tar.gz
redmine-c809c0c49815259a9b75fb3abc3fcfb2782efebd.zip
scm: git: support path encoding in adapter blame (#5251).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5041 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/scm/adapters')
-rw-r--r--lib/redmine/scm/adapters/git_adapter.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb
index 3ba0c9930..69077eadc 100644
--- a/lib/redmine/scm/adapters/git_adapter.rb
+++ b/lib/redmine/scm/adapters/git_adapter.rb
@@ -274,14 +274,14 @@ module Redmine
rescue ScmCommandAborted
nil
end
-
+
def annotate(path, identifier=nil)
identifier = 'HEAD' if identifier.blank?
- cmd = "#{self.class.sq_bin} --git-dir #{target('')} blame -p #{shell_quote identifier} -- #{shell_quote path}"
+ cmd_args = %w|blame|
+ cmd_args << "-p" << identifier << "--" << scm_iconv(@path_encoding, 'UTF-8', path)
blame = Annotate.new
content = nil
- shellout(cmd) { |io| io.binmode; content = io.read }
- return nil if $? && $?.exitstatus != 0
+ scm_cmd(*cmd_args) { |io| io.binmode; content = io.read }
# git annotates binary files
return nil if content.is_binary_data?
identifier = ''
@@ -293,12 +293,16 @@ module Redmine
elsif line =~ /^author (.+)/
authors_by_commit[identifier] = $1.strip
elsif line =~ /^\t(.*)/
- blame.add_line($1, Revision.new(:identifier => identifier, :author => authors_by_commit[identifier]))
+ blame.add_line($1, Revision.new(
+ :identifier => identifier,
+ :author => authors_by_commit[identifier]))
identifier = ''
author = ''
end
end
blame
+ rescue ScmCommandAborted
+ nil
end
def cat(path, identifier=nil)