... | ... |
@@ -438,13 +438,14 @@ sub head_id { |
438 | 438 |
}; |
439 | 439 |
|
440 | 440 |
sub no_merged_branches { |
441 |
- my ($self, $project) = @_; |
|
441 |
+ my ($self, $user, $project) = @_; |
|
442 | 442 |
|
443 | 443 |
# Command "git branch --no-merged" |
444 |
- my @cmd = ($self->cmd($project), 'branch', '--no-merged'); |
|
444 |
+ my @cmd = $self->_cmd($user, $project, 'branch', '--no-merged'); |
|
445 | 445 |
open my $fh, '-|', @cmd or return; |
446 | 446 |
|
447 |
- my @branch_names = map { s/^\*//; s/^\s*//; s/\s*$//; $self->dec($_) } <$fh>; |
|
447 |
+ my @branch_names |
|
448 |
+ = map { s/^\*//; s/^\s*//; s/\s*$//; $self->dec($_) } <$fh>; |
|
448 | 449 |
close $fh or croak qq/Can't open "git branch"/; |
449 | 450 |
|
450 | 451 |
# Branches |
... | ... |
@@ -726,14 +727,19 @@ sub tag { |
726 | 727 |
} |
727 | 728 |
|
728 | 729 |
sub tags { |
729 |
- my ($self, $project, $limit) = @_; |
|
730 |
- |
|
731 |
- # Get tags (command "git for-each-ref") |
|
732 |
- my @cmd = ($self->cmd($project), 'for-each-ref', |
|
733 |
- ($limit ? '--count='.($limit+1) : ()), '--sort=-creatordate', |
|
734 |
- '--format=%(objectname) %(objecttype) %(refname) '. |
|
735 |
- '%(*objectname) %(*objecttype) %(subject)%00%(creator)', |
|
736 |
- 'refs/tags'); |
|
730 |
+ my ($self, $user, $project, $limit) = @_; |
|
731 |
+ |
|
732 |
+ # Get tags |
|
733 |
+ my @cmd = $self->_cmd( |
|
734 |
+ $user, |
|
735 |
+ $project, |
|
736 |
+ 'for-each-ref', |
|
737 |
+ ($limit ? '--count='.($limit+1) : ()), |
|
738 |
+ '--sort=-creatordate', |
|
739 |
+ '--format=%(objectname) %(objecttype) %(refname) ' |
|
740 |
+ . '%(*objectname) %(*objecttype) %(subject)%00%(creator)', |
|
741 |
+ 'refs/tags' |
|
742 |
+ ); |
|
737 | 743 |
open my $fh, '-|', @cmd or return; |
738 | 744 |
|
739 | 745 |
# Parse Tags |
... | ... |
@@ -1,15 +1,10 @@ |
1 | 1 |
<% |
2 |
- use Gitprep::API; |
|
3 |
- |
|
4 | 2 |
# API |
5 |
- my $api = Gitprep::API->new($self); |
|
3 |
+ my $api = gitprep_api; |
|
6 | 4 |
|
7 | 5 |
# Parameters |
8 | 6 |
my $user = param('user'); |
9 | 7 |
my $project = param('project'); |
10 |
- my $root_ns = $api->root_ns(config->{root}); |
|
11 |
- my $rep_ns = "$root_ns/$user/$project.git"; |
|
12 |
- my $rep = "/$rep_ns"; |
|
13 | 8 |
|
14 | 9 |
# Git |
15 | 10 |
my $git = $self->app->git; |
... | ... |
@@ -17,10 +12,10 @@ |
17 | 12 |
# Default branch |
18 | 13 |
my $default_branch = {}; |
19 | 14 |
$default_branch->{name} = 'master'; |
20 |
- $default_branch->{commit} = $git->parse_commit($rep, $default_branch->{name}); |
|
15 |
+ $default_branch->{commit} = $git->parse_commit($user, $project, $default_branch->{name}); |
|
21 | 16 |
|
22 | 17 |
# No merged branches |
23 |
- my $branches = $git->no_merged_branches($rep); |
|
18 |
+ my $branches = $git->no_merged_branches($user, $project); |
|
24 | 19 |
%> |
25 | 20 |
|
26 | 21 |
% layout 'common'; |
... | ... |
@@ -5,17 +5,14 @@ |
5 | 5 |
# Parameters |
6 | 6 |
my $user = param('user'); |
7 | 7 |
my $project = param('project'); |
8 |
- my $root_ns = $api->root_ns(config->{root}); |
|
9 |
- my $rep_ns = "$root_ns/$user/$project.git"; |
|
10 |
- my $rep = "/$rep_ns"; |
|
11 | 8 |
|
12 | 9 |
# Git |
13 | 10 |
my $git = $self->app->git; |
14 | 11 |
|
15 | 12 |
# Ref names |
16 |
- my $tags = $git->tags($rep); |
|
13 |
+ my $tags = $git->tags($user, $project); |
|
17 | 14 |
for my $tag (@$tags) { |
18 |
- $tag->{commit} = $git->parse_commit($rep, $tag->{name}); |
|
15 |
+ $tag->{commit} = $git->parse_commit($user, $project, $tag->{name}); |
|
19 | 16 |
} |
20 | 17 |
%> |
21 | 18 |
|