5291
$paging_nav .= " ⋅ next";
5292
}
5293
5294
+ git_header_html();
5295
+
5296
git_print_page_nav('','', $hash,$co{'tree'},$hash, $paging_nav);
5297
git_print_header_div('commit', esc_html($co{'title'}), $hash);
5298
if ($page == 0 && !@commitlist) {
5300
} else {
5301
git_search_grep_body(\@commitlist, 0, 99, $next_link);
5302
}
5303
+
5304
+ git_footer_html();
5305
}
5306
5307
sub git_search_changes {
5308
my %co = @_;
5309
5310
+ local $/ = "\n";
5311
+ open my $fd, '-|', git_cmd(), '--no-pager', 'log', @diff_opts,
5312
+ '--pretty=format:%H', '--no-abbrev', '--raw', "-S$searchtext",
5313
+ ($search_use_regexp ? '--pickaxe-regex' : ())
5314
+ or die_error(500, "Open git-log failed");
5315
+
5316
+ git_header_html();
5317
+
5318
git_print_page_nav('','', $hash,$co{'tree'},$hash);
5319
git_print_header_div('commit', esc_html($co{'title'}), $hash);
5320
5321
print "<table class=\"pickaxe search\">\n";
5322
my $alternate = 1;
5311
- local $/ = "\n";
5312
- open my $fd, '-|', git_cmd(), '--no-pager', 'log', @diff_opts,
5313
- '--pretty=format:%H', '--no-abbrev', '--raw', "-S$searchtext",
5314
- ($search_use_regexp ? '--pickaxe-regex' : ());
5323
undef %co;
5324
my @files;
5325
while (my $line = <$fd>) {
5383
}
5384
5385
print "</table>\n";
5386
+
5387
+ git_footer_html();
5388
}
5389
5390
sub git_search_files {
5391
my %co = @_;
5392
5393
+ local $/ = "\n";
5394
+ open my $fd, "-|", git_cmd(), 'grep', '-n',
5395
+ $search_use_regexp ? ('-E', '-i') : '-F',
5396
+ $searchtext, $co{'tree'}
5397
+ or die_error(500, "Open git-grep failed");
5398
+
5399
+ git_header_html();
5400
+
5401
git_print_page_nav('','', $hash,$co{'tree'},$hash);
5402
git_print_header_div('commit', esc_html($co{'title'}), $hash);
5403
5404
print "<table class=\"grep_search\">\n";
5405
my $alternate = 1;
5406
my $matches = 0;
5389
- local $/ = "\n";
5390
- open my $fd, "-|", git_cmd(), 'grep', '-n',
5391
- $search_use_regexp ? ('-E', '-i') : '-F',
5392
- $searchtext, $co{'tree'};
5407
my $lastfile = '';
5408
while (my $line = <$fd>) {
5409
chomp $line;
5460
close $fd;
5461
5462
print "</table>\n";
5463
+
5464
+ git_footer_html();
5465
}
5466
5467
sub git_search_grep_body {
7032
$page = 0;
7033
}
7034
7019
- git_header_html();
7020
-
7035
if ($searchtype eq 'commit' ||
7036
$searchtype eq 'author' ||
7037
$searchtype eq 'committer') {
7040
git_search_changes(%co);
7041
} elsif ($searchtype eq 'grep') {
7042
git_search_files(%co);
7043
+ } else {
7044
+ die_error(400, "Unknown search type");
7045
}
7030
-
7031
- git_footer_html();
7046
}
7047
7048
sub git_search_help {