git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/5] gitweb: Clean up code in git_search_* subroutines

From
Jakub Narebski <jnareb@gmail.com>
Date
Jun 22, 2011, 15:28 UTC
Message-ID
<1308756535-29701-5-git-send-email-jnareb@gmail.com>
In-Reply-To
<1308756535-29701-1-git-send-email-jnareb@gmail.com>
1. Replace sequence of
     $foo .= "bar";
     $foo .= "baz";
   with
     $foo .= "bar" .
             "baz";
2. Use href(-replay=>1, -page=>undef) for first page of a multip-page
   view.
3. Rewrap (rearrange) some lines to reduce their length. Some lines
   still have more than 80 characters, but lines are shorter now.
No functional changes.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c350c05..1c06476 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5559,16 +5559,13 @@ sub git_search_message {
 	my $paging_nav = '';
 	if ($page > 0) {
 		$paging_nav .=
-			$cgi->a({-href => href(action=>"search", hash=>$hash,
-			                       searchtext=>$searchtext,
-			                       searchtype=>$searchtype)},
-			        "first");
-		$paging_nav .= " &sdot; " .
+			$cgi->a({-href => href(-replay=>1, page=>undef)},
+			        "first") .
+			" &sdot; " .
 			$cgi->a({-href => href(-replay=>1, page=>$page-1),
 			         -accesskey => "p", -title => "Alt-p"}, "prev");
 	} else {
-		$paging_nav .= "first";
-		$paging_nav .= " &sdot; prev";
+		$paging_nav .= "first &sdot; prev";
 	}
 	my $next_link = '';
 	if ($#commitlist >= 100) {
@@ -5613,10 +5610,13 @@ sub git_search_changes {
 			if (%co) {
 				print "</td>\n" .
 				      "<td class=\"link\">" .
-				      $cgi->a({-href => href(action=>"commit", hash=>$co{'id'})}, "commit") .
+				      $cgi->a({-href => href(action=>"commit", hash=>$co{'id'})},
+				              "commit") .
 				      " | " .
-				      $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$co{'id'})}, "tree");
-				print "</td>\n" .
+				      $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'},
+				                             hash_base=>$co{'id'})},
+				              "tree") .
+				      "</td>\n" .
 				      "</tr>\n";
 			}
 
@@ -5650,10 +5650,13 @@ sub git_search_changes {
 	if (%co) {
 		print "</td>\n" .
 		      "<td class=\"link\">" .
-		      $cgi->a({-href => href(action=>"commit", hash=>$co{'id'})}, "commit") .
+		      $cgi->a({-href => href(action=>"commit", hash=>$co{'id'})},
+		              "commit") .
 		      " | " .
-		      $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$co{'id'})}, "tree");
-		print "</td>\n" .
+		      $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'},
+		                             hash_base=>$co{'id'})},
+		              "tree") .
+		      "</td>\n" .
 		      "</tr>\n";
 	}
 
-- 
1.7.5
Previous: Jakub NarebskiNext: Jakub Narebski
Message 5 of 10 in “gitweb: Improve search code”
  1. 0/5 gitweb: Improve search codeJakub Narebski, Jun 22, 2011
  2. 1/5 gitweb: 'pickaxe' and 'grep' features requires 'search' to be enabledJakub Narebski, Jun 22, 2011
  3. 2/5 gitweb: Check permissions first in git_searchJakub Narebski, Jun 22, 2011
  4. 3/5 gitweb: Split body of git_search into subroutinesJakub Narebski, Jun 22, 2011
  5. 4/5 gitweb: Clean up code in git_search_* subroutinesJakub Narebski, Jun 22, 2011
  6. 5/5 gitweb: Make git_search_* subroutines render whole pagesJakub Narebski, Jun 22, 2011
  7. Phil HordJun 22, 2011
  8. Jakub NarebskiJun 22, 2011
  9. Phil HordJun 22, 2011
  10. Junio C HamanoJun 22, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.