Defect #3832 » 0001-switched-git-blame-to-use-the-porcelain-format-p.patch
| lib/redmine/scm/adapters/git_adapter.rb | ||
|---|---|---|
| 230 | 230 |
|
| 231 | 231 |
def annotate(path, identifier=nil) |
| 232 | 232 |
identifier = 'HEAD' if identifier.blank? |
| 233 |
cmd = "#{GIT_BIN} --git-dir #{target('')} blame -l #{shell_quote identifier} -- #{shell_quote path}"
|
|
| 233 |
cmd = "#{GIT_BIN} --git-dir #{target('')} blame -p #{shell_quote identifier} -- #{shell_quote path}"
|
|
| 234 | 234 |
blame = Annotate.new |
| 235 | 235 |
content = nil |
| 236 | 236 |
shellout(cmd) { |io| io.binmode; content = io.read }
|
| 237 | 237 |
return nil if $? && $?.exitstatus != 0 |
| 238 | 238 |
# git annotates binary files |
| 239 | 239 |
return nil if content.is_binary_data? |
| 240 |
ident = "" |
|
| 241 |
src = "" |
|
| 242 |
auth = Hash.new |
|
| 240 | 243 |
content.split("\n").each do |line|
|
| 241 |
next unless line =~ /([0-9a-f]{39,40})\s\((\w*)[^\)]*\)(.*)/
|
|
| 242 |
blame.add_line($3.rstrip, Revision.new(:identifier => $1, :author => $2.strip)) |
|
| 244 |
if line =~ /^([0-9a-f]{39,40})\s.*/
|
|
| 245 |
ident = $1 |
|
| 246 |
end |
|
| 247 |
if line =~ /^author (.*)/ |
|
| 248 |
auth[ident] = $1.strip |
|
| 249 |
end |
|
| 250 |
if line =~ /^\t(.*)/ |
|
| 251 |
src = $1 |
|
| 252 |
blame.add_line(src, Revision.new(:identifier => ident, :author => auth[ident])) |
|
| 253 |
end |
|
| 243 | 254 |
end |
| 244 |
blame |
|
| 255 |
blame unless blame.empty?
|
|
| 245 | 256 |
end |
| 246 | 257 |
|
| 247 | 258 |
def cat(path, identifier=nil) |
- « Previous
- 1
- 2
- Next »