Always show 'View' and 'Annotate' links on repository files (download will be forced when clicking 'View' if the file is binary).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1274 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -23,7 +23,7 @@ module Redmine
|
||||
'text/css' => 'css',
|
||||
'text/html' => 'html,htm,xhtml',
|
||||
'text/jsp' => 'jsp',
|
||||
'text/x-c' => 'c,cpp,h',
|
||||
'text/x-c' => 'c,cpp,cc,h,hh',
|
||||
'text/x-java' => 'java',
|
||||
'text/x-javascript' => 'js',
|
||||
'text/x-html-template' => 'rhtml',
|
||||
|
||||
@@ -231,13 +231,15 @@ module Redmine
|
||||
identifier = 'HEAD' if identifier.blank?
|
||||
cmd = "#{GIT_BIN} --git-dir #{target('')} blame -l #{shell_quote identifier} -- #{shell_quote path}"
|
||||
blame = Annotate.new
|
||||
shellout(cmd) do |io|
|
||||
io.each_line do |line|
|
||||
next unless line =~ /([0-9a-f]{39,40})\s\((\w*)[^\)]*\)(.*)$/
|
||||
blame.add_line($3.rstrip, Revision.new(:identifier => $1, :author => $2.strip))
|
||||
end
|
||||
end
|
||||
content = nil
|
||||
shellout(cmd) { |io| io.binmode; content = io.read }
|
||||
return nil if $? && $?.exitstatus != 0
|
||||
# git annotates binary files
|
||||
return nil if content.is_binary_data?
|
||||
content.split("\n").each do |line|
|
||||
next unless line =~ /([0-9a-f]{39,40})\s\((\w*)[^\)]*\)(.*)/
|
||||
blame.add_line($3.rstrip, Revision.new(:identifier => $1, :author => $2.strip))
|
||||
end
|
||||
blame
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user