$paging_nav .= " ⋅ next";
}
+ git_header_html();
+
git_print_page_nav('','', $hash,$co{'tree'},$hash, $paging_nav);
git_print_header_div('commit', esc_html($co{'title'}), $hash);
if ($page == 0 && !@commitlist) {
} else {
git_search_grep_body(\@commitlist, 0, 99, $next_link);
}
+
+ git_footer_html();
}
sub git_search_changes {
my %co = @_;
+ local $/ = "\n";
+ open my $fd, '-|', git_cmd(), '--no-pager', 'log', @diff_opts,
+ '--pretty=format:%H', '--no-abbrev', '--raw', "-S$searchtext",
+ ($search_use_regexp ? '--pickaxe-regex' : ())
+ or die_error(500, "Open git-log failed");
+
+ git_header_html();
+
git_print_page_nav('','', $hash,$co{'tree'},$hash);
git_print_header_div('commit', esc_html($co{'title'}), $hash);
print "<table class=\"pickaxe search\">\n";
my $alternate = 1;
- local $/ = "\n";
- open my $fd, '-|', git_cmd(), '--no-pager', 'log', @diff_opts,
- '--pretty=format:%H', '--no-abbrev', '--raw', "-S$searchtext",
- ($search_use_regexp ? '--pickaxe-regex' : ());
undef %co;
my @files;
while (my $line = <$fd>) {
}
print "</table>\n";
+
+ git_footer_html();
}
sub git_search_files {
my %co = @_;
+ local $/ = "\n";
+ open my $fd, "-|", git_cmd(), 'grep', '-n',
+ $search_use_regexp ? ('-E', '-i') : '-F',
+ $searchtext, $co{'tree'}
+ or die_error(500, "Open git-grep failed");
+
+ git_header_html();
+
git_print_page_nav('','', $hash,$co{'tree'},$hash);
git_print_header_div('commit', esc_html($co{'title'}), $hash);
print "<table class=\"grep_search\">\n";
my $alternate = 1;
my $matches = 0;
- local $/ = "\n";
- open my $fd, "-|", git_cmd(), 'grep', '-n',
- $search_use_regexp ? ('-E', '-i') : '-F',
- $searchtext, $co{'tree'};
my $lastfile = '';
while (my $line = <$fd>) {
chomp $line;
close $fd;
print "</table>\n";
+
+ git_footer_html();
}
sub git_search_grep_body {
$page = 0;
}
- git_header_html();
-
if ($searchtype eq 'commit' ||
$searchtype eq 'author' ||
$searchtype eq 'committer') {
git_search_changes(%co);
} elsif ($searchtype eq 'grep') {
git_search_files(%co);
+ } else {
+ die_error(400, "Unknown search type");
}
-
- git_footer_html();
}
sub git_search_help {