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

[PATCH 2/4] gitweb: Change parse_commits signature to allow for multiple options

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 26, 2008, 12:22 UTC
Message-ID
<1204028528-18941-3-git-send-email-jnareb@gmail.com>
In-Reply-To
<1204028528-18941-1-git-send-email-jnareb@gmail.com>

Change order of parameters in parse_commits() to have $filename before @args (extra options), to allow for multiple extra options, for example both '--grep=<pattern>' and '--fixed-strings'.

Change all callers to follow new calling convention.
This is part of commit b98f0a7c in http://repo.or.cz/git/gitweb.git
  gitweb: Clearly distinguish regexp / exact match searches
by Petr "Pasky" Baudis.
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
The paragraph starting with "This is part of commit..." can be now,
I think, safely removed, as the rest of mentioned commit is now fourth
(last) part of this patch series.

BTW. I'm not quite sure about authorship and DCO (signoff) for this patch. It was a part of commit by pasky, but this commit was not written by him. I have written it based on parts of mentioned commit, following variable naming and such; therefore I assumed authorship for this commit.

Original commit was signed off by pasky, and IMHO this signoff applies also to the part of it, therefore I have used also pasky signoff.

 gitweb/gitweb.perl |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index fc95e2c..3b4b15a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2079,7 +2079,7 @@ sub parse_commit {
 }
 
 sub parse_commits {
-	my ($commit_id, $maxcount, $skip, $arg, $filename) = @_;
+	my ($commit_id, $maxcount, $skip, $filename, @args) = @_;
 	my @cos;
 
 	$maxcount ||= 1;
@@ -2089,7 +2089,7 @@ sub parse_commits {
 
 	open my $fd, "-|", git_cmd(), "rev-list",
 		"--header",
-		($arg ? ($arg) : ()),
+		@args,
 		("--max-count=" . $maxcount),
 		("--skip=" . $skip),
 		@extra_options,
@@ -5172,7 +5172,7 @@ sub git_history {
 		$ftype = git_get_type($hash);
 	}
 
-	my @commitlist = parse_commits($hash_base, 101, (100 * $page), "--full-history", $file_name);
+	my @commitlist = parse_commits($hash_base, 101, (100 * $page), $file_name, "--full-history");
 
 	my $paging_nav = '';
 	if ($page > 0) {
@@ -5255,7 +5255,7 @@ sub git_search {
 			$greptype = "--committer=";
 		}
 		$greptype .= $search_regexp;
-		my @commitlist = parse_commits($hash, 101, (100 * $page), $greptype);
+		my @commitlist = parse_commits($hash, 101, (100 * $page), undef, $greptype);
 
 		my $paging_nav = '';
 		if ($page > 0) {
@@ -5507,7 +5507,7 @@ sub git_feed {
 
 	# log/feed of current (HEAD) branch, log of given branch, history of file/directory
 	my $head = $hash || 'HEAD';
-	my @commitlist = parse_commits($head, 150, 0, undef, $file_name);
+	my @commitlist = parse_commits($head, 150, 0, $file_name);
 
 	my %latest_commit;
 	my %latest_date;
-- 
1.5.4.2
Previous: Junio C HamanoNext: Jakub Narebski
Message 7 of 9 in “Improve gitweb search, and other things”
  1. 0/4 Improve gitweb search, and other thingsJakub Narebski, Feb 26, 2008
  2. 1/4 Add '--fixed-strings' option to "git log --grep" and friendsJakub Narebski, Feb 26, 2008
  3. Junio C HamanoFeb 27, 2008
  4. Jakub NarebskiFeb 27, 2008
  5. 1/4 Add '--fixed-strings' option to "git log --grep" and friendsJakub Narebski, Feb 27, 2008
  6. Junio C HamanoFeb 27, 2008
  7. 2/4 gitweb: Change parse_commits signature to allow for multiple optionsJakub Narebski, Feb 26, 2008
  8. 3/4 gitweb: Simplify fixed string searchJakub Narebski, Feb 26, 2008
  9. 4/4 gitweb: Clearly distinguish regexp / exact match searchesJakub Narebski, Feb 26, 2008

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.