... | ... |
@@ -34,6 +34,22 @@ has 'search_max_depth'; |
34 | 34 |
has 'encoding'; |
35 | 35 |
has 'text_exts'; |
36 | 36 |
|
37 |
+sub authors { |
|
38 |
+ my ($self, $rep, $ref, $file) = @_; |
|
39 |
+ |
|
40 |
+ # Command "git log FILE" |
|
41 |
+ my @cmd = ($self->cmd($rep), 'log', '--format=%an', $ref, '--', $file); |
|
42 |
+ open my $fh, "-|", @cmd |
|
43 |
+ or croak 500, "Open git-cat-file failed"; |
|
44 |
+ my $authors = {}; |
|
45 |
+ while (my $line = $self->dec(<$fh>)) { |
|
46 |
+ $line =~ s/[\r\n]//g; |
|
47 |
+ $authors->{$line} = 1; |
|
48 |
+ } |
|
49 |
+ |
|
50 |
+ return [sort keys %$authors]; |
|
51 |
+} |
|
52 |
+ |
|
37 | 53 |
sub blob_plain { |
38 | 54 |
my ($self, $rep, $ref, $path) = @_; |
39 | 55 |
|
... | ... |
@@ -24,6 +24,9 @@ |
24 | 24 |
# Commit |
25 | 25 |
my $commit_log = $git->latest_commit_log($rep, $id, $file); |
26 | 26 |
|
27 |
+ # Authors |
|
28 |
+ my $authors = $git->authors($rep, $id, $file); |
|
29 |
+ |
|
27 | 30 |
# Blob content |
28 | 31 |
my $bid = $git->id_by_path($rep, $id, $file, 'blob') |
29 | 32 |
or $api->croak('Cannot find file'); |
... | ... |
@@ -146,7 +149,7 @@ |
146 | 149 |
</a> |
147 | 150 |
</div> |
148 | 151 |
<div class="bottom"> |
149 |
- 1 contributor |
|
152 |
+ <%= @$authors %> contributor |
|
150 | 153 |
</div> |
151 | 154 |
</div> |
152 | 155 |
|