]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Use rev-list pattern search options.
[Gitweb] / gitweb.perl
index ade2fe6109155275d3589ac5b34028b9968c1edc17762363aea0b079be7ac0f4..84a3b1a9a2bc80df578b4c0543549b88ae297f4ba84824303632950218c9273b 100755 (executable)
@@ -2912,9 +2912,9 @@ sub git_project_index {
 
 sub git_summary {
        my $descr = git_get_project_description($project) || "none";
-       my $head = git_get_head_hash($project);
-       my %co = parse_commit($head);
+       my %co = parse_commit("HEAD");
        my %cd = parse_date($co{'committer_epoch'}, $co{'committer_tz'});
+       my $head = $co{'id'};
 
        my $owner = git_get_project_owner($project);
 
@@ -2961,7 +2961,7 @@ sub git_summary {
        # we need to request one more than 16 (0..15) to check if
        # those 16 are all
        open my $fd, "-|", git_cmd(), "rev-list", "--max-count=17",
-               git_get_head_hash($project), "--"
+               $head, "--"
                or die_error(undef, "Open git-rev-list failed");
        my @revlist = map { chomp; $_ } <$fd>;
        close $fd;
@@ -4177,20 +4177,20 @@ sub git_search {
        print "<table cellspacing=\"0\">\n";
        my $alternate = 1;
        if ($searchtype eq 'commit' or $searchtype eq 'author' or $searchtype eq 'committer') {
+               my $greptype;
+               if ($searchtype eq 'commit') {
+                       $greptype = "--grep=";
+               } elsif ($searchtype eq 'author') {
+                       $greptype = "--author=";
+               } elsif ($searchtype eq 'committer') {
+                       $greptype = "--committer=";
+               }
                $/ = "\0";
                open my $fd, "-|", git_cmd(), "rev-list",
-                       "--header", "--parents", $hash, "--"
+                       "--header", "--parents", ($greptype . $searchtext),
+                        $hash, "--"
                        or next;
                while (my $commit_text = <$fd>) {
-                       if (!grep m/$searchtext/i, $commit_text) {
-                               next;
-                       }
-                       if ($searchtype eq 'author' && !grep m/\nauthor .*$searchtext/i, $commit_text) {
-                               next;
-                       }
-                       if ($searchtype eq 'committer' && !grep m/\ncommitter .*$searchtext/i, $commit_text) {
-                               next;
-                       }
                        my @commit_lines = split "\n", $commit_text;
                        my %co = parse_commit(undef, \@commit_lines);
                        if (!%co) {
This page took 0.246789 seconds and 4 git commands to generate.