... | ... |
@@ -33,9 +33,7 @@ sub rep_work_current_branch { |
33 | 33 |
} |
34 | 34 |
|
35 | 35 |
sub branch { |
36 |
- my ($self, %opt) = @_; |
|
37 |
- my $git_dir = $opt{git_dir}; |
|
38 |
- my $branch_name = $opt{name}; |
|
36 |
+ my ($self, $rep, $branch_name) = @_; |
|
39 | 37 |
|
40 | 38 |
# Branch |
41 | 39 |
$branch_name =~ s/^\*//; |
... | ... |
@@ -43,28 +41,22 @@ sub branch { |
43 | 41 |
$branch_name =~ s/\s*$//; |
44 | 42 |
my $branch = {}; |
45 | 43 |
$branch->{name} = $branch_name; |
46 |
- my $commit = $self->get_commit_new(git_dir => $git_dir, id => $branch_name); |
|
44 |
+ my $commit = $self->get_commit_new($rep, $branch_name); |
|
47 | 45 |
$branch->{commit} = $commit; |
48 | 46 |
|
49 | 47 |
return $branch; |
50 | 48 |
} |
51 | 49 |
|
52 | 50 |
sub branch_status { |
53 |
- my ($self, %opt) = @_; |
|
54 |
- |
|
55 |
- my $git_dir = $opt{git_dir}; |
|
56 |
- my $branch1 = $opt{from}; |
|
57 |
- my $branch2 = $opt{to}; |
|
51 |
+ my ($self, $rep, $branch1, $branch2) = @_; |
|
58 | 52 |
|
59 | 53 |
# Branch status |
60 | 54 |
my $status = {ahead => 0, behind => 0}; |
61 | 55 |
my @cmd = $self->cmd( |
62 |
- git_dir => $git_dir, |
|
63 |
- command => [ |
|
64 |
- 'rev-list', |
|
65 |
- '--left-right', |
|
66 |
- "$branch1...$branch2" |
|
67 |
- ] |
|
56 |
+ $rep, |
|
57 |
+ 'rev-list', |
|
58 |
+ '--left-right', |
|
59 |
+ "$branch1...$branch2" |
|
68 | 60 |
); |
69 | 61 |
open my $fh, '-|', @cmd |
70 | 62 |
or croak "Can't get branch status: @cmd"; |
... | ... |
@@ -77,12 +69,12 @@ sub branch_status { |
77 | 69 |
} |
78 | 70 |
|
79 | 71 |
sub no_merged_branch_h { |
80 |
- my ($self, %opt) = @_; |
|
72 |
+ my ($self, $rep) = @_; |
|
81 | 73 |
|
82 | 74 |
# No merged branches |
83 | 75 |
my $no_merged_branches_h = {}; |
84 | 76 |
{ |
85 |
- my @cmd = $self->cmd(%opt, command => ['branch', '--no-merged']); |
|
77 |
+ my @cmd = $self->cmd($rep, 'branch', '--no-merged'); |
|
86 | 78 |
open my $fh, '-|', @cmd or return; |
87 | 79 |
my @lines = <$fh>; |
88 | 80 |
for my $branch_name (@lines) { |
... | ... |
@@ -98,10 +90,10 @@ sub no_merged_branch_h { |
98 | 90 |
} |
99 | 91 |
|
100 | 92 |
sub branches { |
101 |
- my ($self, %opt) = @_; |
|
93 |
+ my ($self, $rep) = @_; |
|
102 | 94 |
|
103 | 95 |
# Branches |
104 |
- my @cmd = $self->cmd(%opt, command => ['branch']); |
|
96 |
+ my @cmd = $self->cmd($rep, 'branch'); |
|
105 | 97 |
open my $fh, '-|', @cmd or return; |
106 | 98 |
my $branches = []; |
107 | 99 |
my $start; |
... | ... |
@@ -114,11 +106,11 @@ sub branches { |
114 | 106 |
$branch_name =~ s/\s*$//; |
115 | 107 |
|
116 | 108 |
# No merged branch |
117 |
- $no_merged_branches_h = $self->no_merged_branch_h(%opt) |
|
109 |
+ $no_merged_branches_h = $self->no_merged_branch_h($rep) |
|
118 | 110 |
unless $start++; |
119 | 111 |
|
120 | 112 |
# Branch |
121 |
- my $branch = $self->branch(%opt, name => $branch_name); |
|
113 |
+ my $branch = $self->branch($rep, $branch_name); |
|
122 | 114 |
$branch->{no_merged} = 1 if $no_merged_branches_h->{$branch_name}; |
123 | 115 |
push @$branches, $branch; |
124 | 116 |
} |
... | ... |
@@ -128,10 +120,10 @@ sub branches { |
128 | 120 |
} |
129 | 121 |
|
130 | 122 |
sub branches_count { |
131 |
- my ($self, %opt) = @_; |
|
123 |
+ my ($self, $rep) = @_; |
|
132 | 124 |
|
133 | 125 |
# Branches count |
134 |
- my @cmd = $self->cmd(%opt, command => ['branch']); |
|
126 |
+ my @cmd = $self->cmd($rep, 'branch'); |
|
135 | 127 |
open my $fh, '-|', @cmd or return; |
136 | 128 |
my @branches = <$fh>; |
137 | 129 |
my $branches_count = @branches; |
... | ... |
@@ -140,11 +132,10 @@ sub branches_count { |
140 | 132 |
} |
141 | 133 |
|
142 | 134 |
sub cmd { |
143 |
- my ($self, %opt) = @_; |
|
135 |
+ my ($self, $rep, @command) = @_; |
|
144 | 136 |
|
145 |
- my $git_dir = $opt{git_dir}; |
|
146 |
- my $work_tree = $opt{work_tree}; |
|
147 |
- my $command = $opt{command}; |
|
137 |
+ my $git_dir = $rep->{git_dir}; |
|
138 |
+ my $work_tree = $rep->{work_tree}; |
|
148 | 139 |
|
149 | 140 |
my @command_all = ($self->bin); |
150 | 141 |
if (defined $git_dir) { |
... | ... |
@@ -153,7 +144,7 @@ sub cmd { |
153 | 144 |
if (defined $work_tree) { |
154 | 145 |
push @command_all, "--work-tree=$work_tree"; |
155 | 146 |
} |
156 |
- push @command_all, @$command; |
|
147 |
+ push @command_all, @command; |
|
157 | 148 |
|
158 | 149 |
return @command_all; |
159 | 150 |
} |
... | ... |
@@ -189,21 +180,16 @@ sub cmd_work_dir { |
189 | 180 |
} |
190 | 181 |
|
191 | 182 |
sub authors { |
192 |
- my ($self, %opt) = @_; |
|
193 |
- |
|
194 |
- my $rev = $opt{rev}; |
|
195 |
- my $file = $opt{file}; |
|
183 |
+ my ($self, $rep, $rev, $file) = @_; |
|
196 | 184 |
|
197 | 185 |
# Authors |
198 | 186 |
my @cmd = $self->cmd( |
199 |
- %opt, |
|
200 |
- command => [ |
|
201 |
- 'log', |
|
202 |
- '--format=%an', |
|
203 |
- $rev, |
|
204 |
- '--', |
|
205 |
- $file |
|
206 |
- ] |
|
187 |
+ $rep, |
|
188 |
+ 'log', |
|
189 |
+ '--format=%an', |
|
190 |
+ $rev, |
|
191 |
+ '--', |
|
192 |
+ $file |
|
207 | 193 |
); |
208 | 194 |
open my $fh, "-|", @cmd |
209 | 195 |
or croak 500, "Open git-cat-file failed"; |
... | ... |
@@ -219,21 +205,16 @@ sub authors { |
219 | 205 |
} |
220 | 206 |
|
221 | 207 |
sub blame { |
222 |
- my ($self, %opt) = @_; |
|
223 |
- |
|
224 |
- my $rev = $opt{rev}; |
|
225 |
- my $file = $opt{file}; |
|
208 |
+ my ($self, $rep, $rev, $file) = @_; |
|
226 | 209 |
|
227 | 210 |
# Git blame |
228 | 211 |
my @cmd = $self->cmd( |
229 |
- %opt, |
|
230 |
- command => [ |
|
231 |
- 'blame', |
|
232 |
- '--line-porcelain', |
|
233 |
- $rev, |
|
234 |
- '--', |
|
235 |
- $file |
|
236 |
- ] |
|
212 |
+ $rep, |
|
213 |
+ 'blame', |
|
214 |
+ '--line-porcelain', |
|
215 |
+ $rev, |
|
216 |
+ '--', |
|
217 |
+ $file |
|
237 | 218 |
); |
238 | 219 |
open my $fh, '-|', @cmd |
239 | 220 |
or croak "Can't git blame --line-porcelain"; |
... | ... |
@@ -245,7 +226,7 @@ sub blame { |
245 | 226 |
my $min_author_time; |
246 | 227 |
my @lines = <$fh>; |
247 | 228 |
|
248 |
- my $enc = $self->decide_encoding($opt{user}, $opt{project}, \@lines); |
|
229 |
+ my $enc = $self->decide_encoding($rep->{user}, $rep->{project}, \@lines); |
|
249 | 230 |
for my $line (@lines) { |
250 | 231 |
$line = decode($enc, $line); |
251 | 232 |
chomp $line; |
... | ... |
@@ -300,21 +281,16 @@ sub blame { |
300 | 281 |
} |
301 | 282 |
|
302 | 283 |
sub blob { |
303 |
- my ($self, %opt) = @_; |
|
304 |
- |
|
305 |
- my $rev = $opt{rev}; |
|
306 |
- my $file = $opt{file}; |
|
284 |
+ my ($self, $rep, $rev, $file) = @_; |
|
307 | 285 |
|
308 | 286 |
# Blob |
309 |
- my $hash = $self->path_to_hash($opt{user}, $opt{project}, $rev, $file, 'blob') |
|
287 |
+ my $hash = $self->path_to_hash($rep->{user}, $rep->{project}, $rev, $file, 'blob') |
|
310 | 288 |
or croak 'Cannot find file'; |
311 | 289 |
my @cmd = $self->cmd( |
312 |
- %opt, |
|
313 |
- command => [ |
|
314 |
- 'cat-file', |
|
315 |
- 'blob', |
|
316 |
- $hash |
|
317 |
- ] |
|
290 |
+ $rep, |
|
291 |
+ 'cat-file', |
|
292 |
+ 'blob', |
|
293 |
+ $hash |
|
318 | 294 |
); |
319 | 295 |
open my $fh, '-|', @cmd |
320 | 296 |
or croak "Can't cat $file, $hash"; |
... | ... |
@@ -322,7 +298,7 @@ sub blob { |
322 | 298 |
# Format lines |
323 | 299 |
my @lines = <$fh>; |
324 | 300 |
my @new_lines; |
325 |
- my $enc = $self->decide_encoding($opt{user}, $opt{project}, \@lines); |
|
301 |
+ my $enc = $self->decide_encoding($rep->{user}, $rep->{project}, \@lines); |
|
326 | 302 |
for my $line (@lines) { |
327 | 303 |
$line = decode($enc, $line); |
328 | 304 |
chomp $line; |
... | ... |
@@ -333,36 +309,32 @@ sub blob { |
333 | 309 |
} |
334 | 310 |
|
335 | 311 |
sub blob_diffs { |
336 |
- my ($self, %opt) = @_; |
|
312 |
+ my ($self, $rep, $rev1, $rev2, $diff_trees, $opt) = @_; |
|
337 | 313 |
|
338 |
- my $rev1 = $opt{from}; |
|
339 |
- my $rev2 = $opt{to}; |
|
340 |
- my $diff_trees = $opt{diff_trees}; |
|
341 |
- my $ignore_space_change = $opt{ignore_space_change}; |
|
314 |
+ $opt //= {}; |
|
315 |
+ my $ignore_space_change = $opt->{ignore_space_change}; |
|
342 | 316 |
|
343 | 317 |
return unless defined $rev1 && defined $rev2; |
344 | 318 |
|
345 | 319 |
# Diff tree |
346 | 320 |
my @cmd = $self->cmd( |
347 |
- %opt, |
|
348 |
- command => [ |
|
349 |
- 'diff-tree', |
|
350 |
- '-r', |
|
351 |
- '-M', |
|
352 |
- '--no-commit-id', |
|
353 |
- '--patch-with-raw', |
|
354 |
- ($ignore_space_change ? '--ignore-space-change' : ()), |
|
355 |
- $rev1, |
|
356 |
- $rev2, |
|
357 |
- '--' |
|
358 |
- ] |
|
321 |
+ $rep, |
|
322 |
+ 'diff-tree', |
|
323 |
+ '-r', |
|
324 |
+ '-M', |
|
325 |
+ '--no-commit-id', |
|
326 |
+ '--patch-with-raw', |
|
327 |
+ ($ignore_space_change ? '--ignore-space-change' : ()), |
|
328 |
+ $rev1, |
|
329 |
+ $rev2, |
|
330 |
+ '--' |
|
359 | 331 |
); |
360 | 332 |
|
361 | 333 |
open my $fh, '-|', @cmd |
362 | 334 |
or croak('Open self-diff-tree failed'); |
363 | 335 |
my @diff_tree; |
364 | 336 |
my @diff_tree_lines = <$fh>; |
365 |
- my $diff_tree_enc = $self->decide_encoding($opt{user}, $opt{project}, \@diff_tree_lines); |
|
337 |
+ my $diff_tree_enc = $self->decide_encoding($rep->{user}, $rep->{project}, \@diff_tree_lines); |
|
366 | 338 |
for my $line (@diff_tree_lines) { |
367 | 339 |
$line = decode($diff_tree_enc, $line); |
368 | 340 |
chomp $line; |
... | ... |
@@ -383,24 +355,22 @@ sub blob_diffs { |
383 | 355 |
|
384 | 356 |
# Blob diff |
385 | 357 |
my @cmd = $self->cmd( |
386 |
- %opt, |
|
387 |
- command => [ |
|
388 |
- 'diff-tree', |
|
389 |
- '-r', |
|
390 |
- '-M', |
|
391 |
- '-p', |
|
392 |
- ($ignore_space_change ? '--ignore-space-change' : ()), |
|
393 |
- $rev1, |
|
394 |
- $rev2, |
|
395 |
- '--', |
|
396 |
- (defined $from_file ? $from_file : ()), |
|
397 |
- $file |
|
398 |
- ] |
|
358 |
+ $rep, |
|
359 |
+ 'diff-tree', |
|
360 |
+ '-r', |
|
361 |
+ '-M', |
|
362 |
+ '-p', |
|
363 |
+ ($ignore_space_change ? '--ignore-space-change' : ()), |
|
364 |
+ $rev1, |
|
365 |
+ $rev2, |
|
366 |
+ '--', |
|
367 |
+ (defined $from_file ? $from_file : ()), |
|
368 |
+ $file |
|
399 | 369 |
); |
400 | 370 |
open my $fh, '-|', @cmd |
401 | 371 |
or croak('Open self-diff-tree failed'); |
402 | 372 |
my @lines = <$fh>; |
403 |
- my $enc = $self->decide_encoding($opt{user}, $opt{project}, \@lines); |
|
373 |
+ my $enc = $self->decide_encoding($rep->{user}, $rep->{project}, \@lines); |
|
404 | 374 |
@lines = map { decode($enc, $_) } @lines; |
405 | 375 |
close $fh; |
406 | 376 |
my ($lines, $diff_info) = $self->parse_blob_diff_lines(\@lines); |
... | ... |
@@ -433,22 +403,21 @@ sub blob_diffs { |
433 | 403 |
} |
434 | 404 |
|
435 | 405 |
sub blob_is_image { |
436 |
- my ($self, $user, $project, $rev, $file) = @_; |
|
406 |
+ my $self = shift; |
|
437 | 407 |
|
438 |
- my $mime_type = $self->blob_mime_type($user, $project, $rev, $file); |
|
408 |
+ my $mime_type = $self->blob_mime_type(@_); |
|
439 | 409 |
|
440 | 410 |
return ($mime_type || '') =~ m#^image/#; |
441 | 411 |
} |
442 | 412 |
|
443 | 413 |
sub blob_mime_type { |
444 |
- my ($self, $user, $project, $rev, $file) = @_; |
|
414 |
+ my ($self, $rep, $rev, $file) = @_; |
|
445 | 415 |
|
446 | 416 |
# Blob |
447 |
- my $hash = $self->path_to_hash($user, $project, $rev, $file, 'blob') |
|
417 |
+ my $hash = $self->path_to_hash($rep->{user}, $rep->{project}, $rev, $file, 'blob') |
|
448 | 418 |
or croak 'Cannot find file'; |
449 |
- my @cmd = $self->cmd_rep( |
|
450 |
- $user, |
|
451 |
- $project, |
|
419 |
+ my @cmd = $self->cmd( |
|
420 |
+ $rep, |
|
452 | 421 |
'cat-file', |
453 | 422 |
'blob', |
454 | 423 |
$hash |
... | ... |
@@ -475,10 +444,10 @@ sub blob_mime_type { |
475 | 444 |
} |
476 | 445 |
|
477 | 446 |
sub blob_content_type { |
478 |
- my ($self, $user, $project, $rev, $file) = @_; |
|
447 |
+ my $self = shift; |
|
479 | 448 |
|
480 | 449 |
# Content type |
481 |
- my $type = $self->blob_mime_type($user, $project, $rev, $file); |
|
450 |
+ my $type = $self->blob_mime_type(@_); |
|
482 | 451 |
if ($type eq 'text/plain') { |
483 | 452 |
$type .= "; charset=" . $self->default_encoding; |
484 | 453 |
} |
... | ... |
@@ -595,7 +564,7 @@ sub exists_branch { |
595 | 564 |
sub delete_branch { |
596 | 565 |
my ($self, $user, $project, $branch) = @_; |
597 | 566 |
|
598 |
- my $branches = $self->branches(%{$self->app->rep_info($user, $project)}); |
|
567 |
+ my $branches = $self->branches($self->app->rep_info($user, $project)); |
|
599 | 568 |
my $exists; |
600 | 569 |
for my $b (@$branches) { |
601 | 570 |
if ($branch eq $b->{name}) { |
... | ... |
@@ -1268,24 +1237,20 @@ sub get_commit { |
1268 | 1237 |
} |
1269 | 1238 |
|
1270 | 1239 |
sub get_commit_new { |
1271 |
- my ($self, %opt) = @_; |
|
1240 |
+ my ($self, $rep, $id) = @_; |
|
1272 | 1241 |
|
1273 |
- my $git_dir = $opt{git_dir}; |
|
1274 |
- my $work_tree = $opt{work_tree}; |
|
1275 |
- my $id = $opt{id}; |
|
1242 |
+ my $git_dir = $rep->{git_dir}; |
|
1243 |
+ my $work_tree = $rep->{work_tree}; |
|
1276 | 1244 |
|
1277 | 1245 |
# Git rev-list |
1278 | 1246 |
my @cmd = $self->cmd( |
1279 |
- git_dir => $git_dir, |
|
1280 |
- work_tree => $work_tree, |
|
1281 |
- command => [ |
|
1282 |
- 'rev-list', |
|
1283 |
- '--parents', |
|
1284 |
- '--header', |
|
1285 |
- '--max-count=1', |
|
1286 |
- $id, |
|
1287 |
- '--' |
|
1288 |
- ] |
|
1247 |
+ $rep, |
|
1248 |
+ 'rev-list', |
|
1249 |
+ '--parents', |
|
1250 |
+ '--header', |
|
1251 |
+ '--max-count=1', |
|
1252 |
+ $id, |
|
1253 |
+ '--' |
|
1289 | 1254 |
); |
1290 | 1255 |
open my $fh, '-|', @cmd |
1291 | 1256 |
or croak 'Open git-rev-list failed'; |
... | ... |
@@ -5,7 +5,7 @@ |
5 | 5 |
my $git = app->git; |
6 | 6 |
|
7 | 7 |
# Branches |
8 |
- my $branches = $git->branches(%{$self->app->rep_info($user, $project)}) || []; |
|
8 |
+ my $branches = $git->branches($self->app->rep_info($user, $project)) || []; |
|
9 | 9 |
my @branch_names = map { $_->{name} } @$branches; |
10 | 10 |
|
11 | 11 |
# Tags |
... | ... |
@@ -113,7 +113,7 @@ |
113 | 113 |
my $project = $project->{name}; |
114 | 114 |
my $rev = app->manager->default_branch($user, $project); |
115 | 115 |
my $desc = app->git->description($user, $project); |
116 |
- my $branches = app->git->branches(%{$self->app->rep_info($user, $project)}); |
|
116 |
+ my $branches = app->git->branches($self->app->rep_info($user, $project)); |
|
117 | 117 |
my $commit; |
118 | 118 |
if (@$branches) { |
119 | 119 |
$commit = app->git->get_commit($user, $project, $rev); |
... | ... |
@@ -15,7 +15,7 @@ |
15 | 15 |
my $commit = $git->last_change_commit($user, $project, $rev, $file); |
16 | 16 |
|
17 | 17 |
# Authors |
18 |
- my $authors = $git->authors(%{$self->app->rep_info($user, $project)}, rev => $rev, file => $file); |
|
18 |
+ my $authors = $git->authors($self->app->rep_info($user, $project), $rev, $file); |
|
19 | 19 |
|
20 | 20 |
# File size |
21 | 21 |
my $file_size = $git->blob_size($user, $project, $rev, $file); |
... | ... |
@@ -25,10 +25,10 @@ |
25 | 25 |
my $file_type = $git->file_type_long($mode); |
26 | 26 |
|
27 | 27 |
# MIME type |
28 |
- my $mime_type = $git->blob_mime_type($user, $project, $rev, $file); |
|
28 |
+ my $mime_type = $git->blob_mime_type(app->rep_info($user, $project), $rev, $file); |
|
29 | 29 |
|
30 | 30 |
# Blame |
31 |
- my $blame = $git->blame(%{app->rep_info($user, $project)}, rev => $rev, file => $file); |
|
31 |
+ my $blame = $git->blame(app->rep_info($user, $project), $rev, $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}; |
... | ... |
@@ -22,7 +22,7 @@ |
22 | 22 |
)->value; |
23 | 23 |
|
24 | 24 |
# Authors |
25 |
- my $authors = $git->authors(%{$self->app->rep_info($user, $project)}, rev => $rev, file => $file); |
|
25 |
+ my $authors = $git->authors($self->app->rep_info($user, $project), $rev, $file); |
|
26 | 26 |
|
27 | 27 |
# File size |
28 | 28 |
my $file_size = $git->blob_size($user, $project, $rev, $file); |
... | ... |
@@ -32,11 +32,11 @@ |
32 | 32 |
my $file_type = $git->file_type_long($mode); |
33 | 33 |
|
34 | 34 |
# MIME type |
35 |
- my $mime_type = $git->blob_mime_type($user, $project, $rev, $file); |
|
35 |
+ my $mime_type = $git->blob_mime_type(app->rep_info($user, $project), $rev, $file); |
|
36 | 36 |
|
37 | 37 |
# Blob lines(only text) |
38 | 38 |
my $lines; |
39 |
- $lines = $git->blob(%{app->rep_info($user, $project)}, rev => $rev, file => $file) if $mime_type =~ /^text/; |
|
39 |
+ $lines = $git->blob(app->rep_info($user, $project), $rev, $file) if $mime_type =~ /^text/; |
|
40 | 40 |
|
41 | 41 |
# Variables for included template |
42 | 42 |
stash(id => $rev, project => $project, rev => $rev); |
... | ... |
@@ -55,7 +55,7 @@ |
55 | 55 |
|
56 | 56 |
# Default branch |
57 | 57 |
my $default_branch_name = app->manager->default_branch($user, $project); |
58 |
- my $default_branch = $git->branch(%{$self->app->rep_info($user, $project)}, name => $default_branch_name); |
|
58 |
+ my $default_branch = $git->branch($self->app->rep_info($user, $project), $default_branch_name); |
|
59 | 59 |
|
60 | 60 |
# Branches |
61 | 61 |
my $branch_types; |
... | ... |
@@ -70,16 +70,16 @@ |
70 | 70 |
my $page_count = 20; |
71 | 71 |
my $skip = $page_count * ($page - 1); |
72 | 72 |
|
73 |
- my $branches = $git->branches(%{$self->app->rep_info($user, $project)}); |
|
73 |
+ my $branches = $git->branches($self->app->rep_info($user, $project)); |
|
74 | 74 |
my $max = 0; |
75 | 75 |
my $active_count = 0; |
76 | 76 |
my $stale_count = 0; |
77 | 77 |
my $all_count = 0; |
78 | 78 |
for my $branch (@$branches) { |
79 | 79 |
$branch->{status} = $git->branch_status( |
80 |
- %{$self->app->rep_info($user, $project)}, |
|
81 |
- from => $default_branch->{name}, |
|
82 |
- to => $branch->{name} |
|
80 |
+ $self->app->rep_info($user, $project), |
|
81 |
+ $default_branch->{name}, |
|
82 |
+ $branch->{name} |
|
83 | 83 |
); |
84 | 84 |
$max = $branch->{status}{ahead} if $max < $branch->{status}{ahead}; |
85 | 85 |
$max = $branch->{status}{behind} if $max < $branch->{status}{behind}; |
... | ... |
@@ -42,7 +42,7 @@ |
42 | 42 |
} |
43 | 43 |
|
44 | 44 |
# Branches |
45 |
- my $branches = $git->branches($user, $project); |
|
45 |
+ my $branches = $git->branches(app->rep_info($user, $project)); |
|
46 | 46 |
@$branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$branches; |
47 | 47 |
|
48 | 48 |
# Variables |
... | ... |
@@ -16,7 +16,7 @@ |
16 | 16 |
|
17 | 17 |
# Branches |
18 | 18 |
my $git = app->git; |
19 |
- my $remote_branches = $git->branches(%{$self->app->rep_info($remote_user, $remote_project)}); |
|
19 |
+ my $remote_branches = $git->branches($self->app->rep_info($remote_user, $remote_project)); |
|
20 | 20 |
my $remote_branch_names = [map { $_->{name} } @$remote_branches]; |
21 | 21 |
|
22 | 22 |
my $op = param('op') || ''; |
... | ... |
@@ -73,7 +73,7 @@ |
73 | 73 |
if ($validation->is_valid) { |
74 | 74 |
|
75 | 75 |
# Check branch name |
76 |
- my $branches = $git->branches(%{$self->app->rep_info($user, $project)}); |
|
76 |
+ my $branches = $git->branches($self->app->rep_info($user, $project)); |
|
77 | 77 |
|
78 | 78 |
if (!$force && grep { $branch eq $_->{name} } @$branches) { |
79 | 79 |
$errors = ["Branch \"$branch\" is already exists. If you want to import this branch, check force option."]; |
... | ... |
@@ -21,21 +21,22 @@ |
21 | 21 |
|
22 | 22 |
if ($blob_diff->{binary}) { |
23 | 23 |
if ($status eq 'A') { |
24 |
- if ($git->blob_is_image($user, $project, $rev, $file)) { |
|
24 |
+ if ($git->blob_is_image(app->rep_info($user, $project), $rev, $file)) { |
|
25 | 25 |
$binary_rev_shown = 1; |
26 | 26 |
} |
27 | 27 |
else { |
28 | 28 |
$binary_not_shown = 1; |
29 | 29 |
} |
30 | 30 |
} elsif ($status eq 'D') { |
31 |
- if ($git->blob_is_image($user, $project, $from_rev, $file)) { |
|
31 |
+ if ($git->blob_is_image(app->rep_info($user, $project), $from_rev, $file)) { |
|
32 | 32 |
$binary_from_rev_shown = 1; |
33 | 33 |
} |
34 | 34 |
else { |
35 | 35 |
$binary_not_shown = 1; |
36 | 36 |
} |
37 | 37 |
} else { |
38 |
- if ($git->blob_is_image($user, $project, $from_rev, $file) && $git->blob_is_image($user, $project, $from_rev, $file)) { |
|
38 |
+ if ($git->blob_is_image(app->rep_info($user, $project), $from_rev, $file) |
|
39 |
+ && $git->blob_is_image(app->rep_info($user, $project), $from_rev, $file)) { |
|
39 | 40 |
$binary_from_rev_shown = 1; |
40 | 41 |
$binary_rev_shown = 1; |
41 | 42 |
} |
... | ... |
@@ -36,11 +36,11 @@ |
36 | 36 |
|
37 | 37 |
# Get blob diffs |
38 | 38 |
my $blob_diffs = $git->blob_diffs( |
39 |
- %{app->rep_info($user, $project)}, |
|
40 |
- from => $from_rev, |
|
41 |
- to => $rev, |
|
42 |
- diff_trees => $diff_trees, |
|
43 |
- ignore_space_change => $ignore_space_change |
|
39 |
+ app->rep_info($user, $project), |
|
40 |
+ $from_rev, |
|
41 |
+ $rev, |
|
42 |
+ $diff_trees, |
|
43 |
+ {ignore_space_change => $ignore_space_change} |
|
44 | 44 |
) || []; |
45 | 45 |
|
46 | 46 |
my $blob_diffs_h = {}; |
... | ... |
@@ -8,7 +8,7 @@ |
8 | 8 |
my $type = ''; |
9 | 9 |
my $lines; |
10 | 10 |
my $readme_path = (defined $dir && $dir ne '') ? "$dir/README" : 'README'; |
11 |
- eval { $lines = app->git->blob(%{app->rep_info($user, $project)}, rev => $rev, file => $readme_path) }; |
|
11 |
+ eval { $lines = app->git->blob(app->rep_info($user, $project), $rev, $readme_path) }; |
|
12 | 12 |
my $readme_e; |
13 | 13 |
|
14 | 14 |
if ($lines) { |
... | ... |
@@ -18,7 +18,7 @@ |
18 | 18 |
$readme_e =~ s#(^|\s|[^\x00-\x7F])(http(?:s)?://.+?)($|\s|[^\x00-\x7F])#$1<a href="$2">$2</a>$3#msg; |
19 | 19 |
} |
20 | 20 |
else { |
21 |
- eval { $lines = app->git->blob(%{app->rep_info($user, $project)}, rev => $rev, file => "$readme_path.md") }; |
|
21 |
+ eval { $lines = app->git->blob(app->rep_info($user, $project), $rev, "$readme_path.md") }; |
|
22 | 22 |
if ($lines) { |
23 | 23 |
$type = 'markdown'; |
24 | 24 |
my $readme = join "\n", @$lines; |
... | ... |
@@ -3,7 +3,7 @@ |
3 | 3 |
my $api = gitprep_api; |
4 | 4 |
|
5 | 5 |
# Branches |
6 |
- my $branches = [map { $_->{name} } @{app->git->branches(%{$self->app->rep_info($user, $project)})}]; |
|
6 |
+ my $branches = [map { $_->{name} } @{app->git->branches($self->app->rep_info($user, $project))}]; |
|
7 | 7 |
|
8 | 8 |
# Members |
9 | 9 |
my $members = app->manager->members($user, $project); |
... | ... |
@@ -11,7 +11,7 @@ |
11 | 11 |
# Members branches |
12 | 12 |
for my $member (@$members) { |
13 | 13 |
my $branches = [ |
14 |
- map { $_->{name} } @{app->git->branches(%{$self->app->rep_info($member->{id}, $member->{project})})} |
|
14 |
+ map { $_->{name} } @{app->git->branches($self->app->rep_info($member->{id}, $member->{project}))} |
|
15 | 15 |
]; |
16 | 16 |
$member->{branches} = $branches; |
17 | 17 |
} |
... | ... |
@@ -12,7 +12,7 @@ |
12 | 12 |
my $blob_raw = $git->blob_raw($user, $project, $rev, $file); |
13 | 13 |
|
14 | 14 |
# Content type |
15 |
- my $type = $git->blob_content_type($user, $project, $rev, $file); |
|
15 |
+ my $type = $git->blob_content_type(app->rep_info($user, $project), $rev, $file); |
|
16 | 16 |
|
17 | 17 |
# File name |
18 | 18 |
my $file_name = $rev; |
... | ... |
@@ -229,7 +229,7 @@ |
229 | 229 |
<li id="default-branch"> |
230 | 230 |
Default Branch |
231 | 231 |
<% |
232 |
- my $branches = $git->branches(%{$self->app->rep_info($user, $project)}); |
|
232 |
+ my $branches = $git->branches($self->app->rep_info($user, $project)); |
|
233 | 233 |
my $branch_names = [map { $_->{name} } @$branches]; |
234 | 234 |
my $default_branch = app->manager->default_branch($user, $project); |
235 | 235 |
push @$branch_names, $default_branch unless @$branch_names; |
... | ... |
@@ -15,7 +15,7 @@ |
15 | 15 |
my $file_base = File::Basename::basename $file; |
16 | 16 |
|
17 | 17 |
# Blob lines |
18 |
- my $lines = $git->blob(%{app->rep_info($user, $project)}, rev => $rev, file => '.gitmodules'); |
|
18 |
+ my $lines = $git->blob(app->rep_info($user, $project), $rev, '.gitmodules'); |
|
19 | 19 |
|
20 | 20 |
my $submodule_rep_url; |
21 | 21 |
my $match; |
... | ... |
@@ -71,7 +71,7 @@ |
71 | 71 |
. ($ssh_port ? ":$ssh_port" : '') . "$ssh_rep_url_base/$user/$project.git"; |
72 | 72 |
|
73 | 73 |
my $branches = stash('branches'); |
74 |
- my $branches_count = app->git->branches_count(%{$self->app->rep_info($user, $project)}); |
|
74 |
+ my $branches_count = app->git->branches_count($self->app->rep_info($user, $project)); |
|
75 | 75 |
my $default_branch_name = app->manager->default_branch($user, $project); |
76 | 76 |
my $tags_count = app->git->tags_count($user, $project); |
77 | 77 |
|