... | ... |
@@ -219,21 +219,21 @@ sub authors { |
219 | 219 |
} |
220 | 220 |
|
221 | 221 |
sub blame { |
222 |
- my ($self, $user, $project, $rev, $file) = @_; |
|
222 |
+ my ($self, %opt) = @_; |
|
223 | 223 |
|
224 |
- # Blob |
|
225 |
- my $hash = $self->path_to_hash($user, $project, $rev, $file, 'blob') |
|
226 |
- or croak 'Cannot find file'; |
|
224 |
+ my $rev = $opt{rev}; |
|
225 |
+ my $file = $opt{file}; |
|
227 | 226 |
|
228 | 227 |
# Git blame |
229 |
- my @cmd = $self->cmd_rep( |
|
230 |
- $user, |
|
231 |
- $project, |
|
232 |
- 'blame', |
|
233 |
- '--line-porcelain', |
|
234 |
- $rev, |
|
235 |
- '--', |
|
236 |
- $file |
|
228 |
+ my @cmd = $self->cmd( |
|
229 |
+ %opt, |
|
230 |
+ command => [ |
|
231 |
+ 'blame', |
|
232 |
+ '--line-porcelain', |
|
233 |
+ $rev, |
|
234 |
+ '--', |
|
235 |
+ $file |
|
236 |
+ ] |
|
237 | 237 |
); |
238 | 238 |
open my $fh, '-|', @cmd |
239 | 239 |
or croak "Can't git blame --line-porcelain"; |
... | ... |
@@ -245,7 +245,7 @@ sub blame { |
245 | 245 |
my $min_author_time; |
246 | 246 |
my @lines = <$fh>; |
247 | 247 |
|
248 |
- my $enc = $self->decide_encoding($user, $project, \@lines); |
|
248 |
+ my $enc = $self->decide_encoding($opt{user}, $opt{project}, \@lines); |
|
249 | 249 |
for my $line (@lines) { |
250 | 250 |
$line = decode($enc, $line); |
251 | 251 |
chomp $line; |
... | ... |
@@ -1814,7 +1814,7 @@ sub decide_encoding { |
1814 | 1814 |
)->value; |
1815 | 1815 |
|
1816 | 1816 |
my @guess_encodings; |
1817 |
- if (length $guess_encoding_str) { |
|
1817 |
+ if (defined $guess_encoding_str && length $guess_encoding_str) { |
|
1818 | 1818 |
@guess_encodings = split(/\s*,\s*/, $guess_encoding_str); |
1819 | 1819 |
} |
1820 | 1820 |
|
... | ... |
@@ -28,7 +28,7 @@ |
28 | 28 |
my $mime_type = $git->blob_mime_type($user, $project, $rev, $file); |
29 | 29 |
|
30 | 30 |
# Blame |
31 |
- my $blame = $git->blame($user, $project, $rev, $file); |
|
31 |
+ my $blame = $git->blame(%{app->rep_info($user, $project)}, rev => $rev, file => $file); |
|
32 | 32 |
my $blame_lines = $blame->{lines}; |
33 | 33 |
my $blame_min_author_time = $blame->{min_author_time}; |
34 | 34 |
my $blame_max_author_time = $blame->{max_author_time}; |