Skip to contentSkip to conversation

A few gitweb cleanups and improvements

PATCH In review Jakub Narebski 3 participants 12 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover A few gitweb cleanups and improvements

A few gitweb cleanups, refactoring, and improvements. Based on 'master', 1c2a4f5addce479c619057c6cdc841802139982f First patch in series was sent earlier.

 gitweb/gitweb.perl |   80 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 74 insertions(+), 6 deletions(-)

Jakub Narebski:
gitweb: Add support for per project git URLs
gitweb: Refactor printing commit message
gitweb: Fix typo in separation of git_difftree_body
gitweb: Expand href() function to use key as param name for no mapping
gitweb: Added parse_difftree_raw_line function for later use
gitweb: Sort query string parameters in href() function
gitweb: Uniquify version info output, add meta generator in page header

Signature · 2 lines
Jakub Narebski
Poland
#1 lore raw

PATCH 1/7 gitweb: Add support for per project git URLs

It is now possible for project to have individual clone/fetch URLs. They are provided in new file 'cloneurl' added below project's $GIT_DIR directory.

If there is no cloneurl file, concatenation of git base URLs with project name is used.

This is merge of Jakub Narebski and David Rientjes
gitweb: Show project's git URL on summary page
with Aneesh Kumar
gitweb: Add support for cloneurl.
gitweb: Support multiple clone urls
patches.

---
 gitweb/gitweb.perl |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
gitweb/gitweb.perl +17 -3
index 37a6284..7c92ac3 100755
@@ -533,6 +533,16 @@ sub git_get_project_description {
 	return $descr;
 }
 
+sub git_get_project_url_list {
+	my $path = shift;
+
+	open my $fd, "$projectroot/$path/cloneurl" or return undef;
+	my @git_project_url_list = map { chomp; $_ } <$fd>;
+	close $fd;
+
+	return wantarray ? @git_project_url_list : \@git_project_url_list;
+}
+
 sub git_get_projects_list {
 	my @list;
 
@@ -1697,10 +1707,14 @@ sub git_summary {
 	      "<tr><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" .
 	      "<tr><td>owner</td><td>$owner</td></tr>\n" .
 	      "<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n";
+	# use per project git URL list in $projectroot/$project/cloneurl
+	# or make project git URL from git base URL and project name
 	my $url_tag = "URL";
-	foreach my $git_base_url (@git_base_url_list) {
-		next unless $git_base_url;
-		print "<tr><td>$url_tag</td><td>$git_base_url/$project</td></tr>\n";
+	my @url_list = git_get_project_url_list($project);
+	@url_list = map { "$_/$project" } @git_base_url_list unless @url_list;
+	foreach my $git_url (@url_list) {
+		next unless $git_url;
+		print "<tr><td>$url_tag</td><td>$git_url</td></tr>\n";
 		$url_tag = "";
 	}
 	print "</table>\n";
Signature · 1 line
1.4.1.1
#2 lore raw

Re: [PATCH 1/7] gitweb: Add support for per project git URLs

Quoted 14 lines · Jakub Narebski

It is now possible for project to have individual clone/fetch URLs. They are provided in new file 'cloneurl' added below project's $GIT_DIR directory.

If there is no cloneurl file, concatenation of git base URLs with project name is used.

This is merge of Jakub Narebski and David Rientjes
gitweb: Show project's git URL on summary page
with Aneesh Kumar
gitweb: Add support for cloneurl.
gitweb: Support multiple clone urls
patches.

Quoted 2 lines
#3 lore raw

PATCH 2/7 gitweb: Refactor printing commit message

In reply to Jakub Narebski

Separate pretty-printing commit message (comment) into git_print_log and git_print_simplified_log subroutines. As of now the former is used in git_commit, the latter in git_log and git_commitdiff.

---
 gitweb/gitweb.perl |  132 ++++++++++++++++++++++++++--------------------------
 1 files changed, 67 insertions(+), 65 deletions(-)
gitweb/gitweb.perl +67 -65
index 7c92ac3..0d869f2 100755
@@ -1174,6 +1174,66 @@ sub git_print_page_path {
 	}
 }
 
+sub git_print_log {
+	my $log = shift;
+
+	# remove leading empty lines
+	while (defined $log->[0] && $log->[0] eq "") {
+		shift @$log;
+	}
+
+	# print log
+	my $signoff = 0;
+	my $empty = 0;
+	foreach my $line (@$log) {
+		# print only one empty line
+		# do not print empty line after signoff
+		if ($line eq "") {
+			next if ($empty || $signoff);
+			$empty = 1;
+		} else {
+			$empty = 0;
+		}
+		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
+			$signoff = 1;
+			print "<span class=\"signoff\">" . esc_html($line) . "</span><br/>\n";
+		} else {
+			$signoff = 0;
+			print format_log_line_html($line) . "<br/>\n";
+		}
+	}
+}
+
+sub git_print_simplified_log {
+	my $log = shift;
+	my $remove_title = shift;
+
+	shift @$log if $remove_title;
+	# remove leading empty lines
+	while (defined $log->[0] && $log->[0] eq "") {
+		shift @$log;
+	}
+
+	# simplify and print log
+	my $empty = 0;
+	foreach my $line (@$log) {
+		# remove signoff lines
+		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
+			next;
+		}
+		# print only one empty line
+		if ($line eq "") {
+			next if $empty;
+			$empty = 1;
+		} else {
+			$empty = 0;
+		}
+		print format_log_line_html($line) . "<br/>\n";
+	}
+	# end with single empty line
+	print "<br/>\n" unless $empty;
+}
+
 ## ......................................................................
 ## functions printing large fragments of HTML
 
@@ -2155,27 +2215,10 @@ sub git_log {
 		      "<br/>\n" .
 		      "</div>\n" .
 		      "<i>" . esc_html($co{'author_name'}) .  " [$ad{'rfc2822'}]</i><br/>\n" .
-		      "</div>\n" .
-		      "<div class=\"log_body\">\n";
-		my $comment = $co{'comment'};
-		my $empty = 0;
-		foreach my $line (@$comment) {
-			if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
-				next;
-			}
-			if ($line eq "") {
-				if ($empty) {
-					next;
-				}
-				$empty = 1;
-			} else {
-				$empty = 0;
-			}
-			print format_log_line_html($line) . "<br/>\n";
-		}
-		if (!$empty) {
-			print "<br/>\n";
-		}
+		      "</div>\n";
+
+		print "<div class=\"log_body\">\n";
+		git_print_simplified_log($co{'comment'});
 		print "</div>\n";
 	}
 	git_footer_html();
@@ -2256,28 +2299,9 @@ sub git_commit {
 	}
 	print "</table>".
 	      "</div>\n";
+
 	print "<div class=\"page_body\">\n";
-	my $comment = $co{'comment'};
-	my $empty = 0;
-	my $signed = 0;
-	foreach my $line (@$comment) {
-		# print only one empty line
-		if ($line eq "") {
-			if ($empty || $signed) {
-				next;
-			}
-			$empty = 1;
-		} else {
-			$empty = 0;
-		}
-		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
-			$signed = 1;
-			print "<span class=\"signoff\">" . esc_html($line) . "</span><br/>\n";
-		} else {
-			$signed = 0;
-			print format_log_line_html($line) . "<br/>\n";
-		}
-	}
+	git_print_log($co{'comment'});
 	print "</div>\n";
 
 	git_difftree_body(\@difftree, $parent);
@@ -2343,29 +2367,7 @@ sub git_commitdiff {
 	git_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);
 	git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash);
 	print "<div class=\"page_body\">\n";
-	my $comment = $co{'comment'};
-	my $empty = 0;
-	my $signed = 0;
-	my @log = @$comment;
-	# remove first and empty lines after that
-	shift @log;
-	while (defined $log[0] && $log[0] eq "") {
-		shift @log;
-	}
-	foreach my $line (@log) {
-		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
-			next;
-		}
-		if ($line eq "") {
-			if ($empty) {
-				next;
-			}
-			$empty = 1;
-		} else {
-			$empty = 0;
-		}
-		print format_log_line_html($line) . "<br/>\n";
-	}
+	git_print_simplified_log($co{'comment'}, 1); # skip title
 	print "<br/>\n";
 	foreach my $line (@difftree) {
 		# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M      ls-files.c'
Signature · 1 line
1.4.1.1
#4 lore raw

PATCH 3/7 gitweb: Fix typo in separation of git_difftree_body

In reply to Jakub Narebski
---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +1 -1
index 0d869f2..86266da 100755
@@ -1322,7 +1322,7 @@ sub git_difftree_body {
 			      "<td class=\"link\">" .
 				$cgi->a({-href => href(action=>"blob", hash=>$to_id, hash_base=>$hash, file_name=>$file)}, "blob");
 			if ($to_id ne $from_id) { # modified
-				print $cgi->a({-href => href(action=>"blobdiff", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$file)}, "diff");
+				print " | " . $cgi->a({-href => href(action=>"blobdiff", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$file)}, "diff");
 			}
 			print " | " . $cgi->a({-href => href(action=>"history", hash_base=>$hash, file_name=>$file)}, "history") . "\n";
 			print "</td>\n";
Signature · 1 line
1.4.1.1
#5 lore raw

PATCH 4/7 gitweb: Expand href() function to use key as param name for no mapping

In reply to Jakub Narebski

Expand href() function to use key name of params hash as a query param name, if there is no mapping for given key name.

It is now safer to use href(); no errors, but links might not work correctly if caller didn't provide correct arguments.

Future proofing.

---
 gitweb/gitweb.perl |  143 +++++++++++++++++++++++++++-------------------------
 1 files changed, 73 insertions(+), 70 deletions(-)
gitweb/gitweb.perl +73 -70
index 86266da..d37e7f1 100755
@@ -204,8 +204,13 @@ sub href(%) {
 
 	my $href = "$my_uri?";
 	$href .= esc_param( join(";",
-		map { "$mapping{$_}=$params{$_}" } keys %params
-	) );
+		map {
+			if (exists $mapping{$_}) {
+				"$mapping{$_}=$params{$_}";
+			} else {
+				"$_=$params{$_}";
+			}
+		} keys %params ) );
 
 	return $href;
 }
@@ -1174,66 +1179,6 @@ sub git_print_page_path {
 	}
 }
 
-sub git_print_log {
-	my $log = shift;
-
-	# remove leading empty lines
-	while (defined $log->[0] && $log->[0] eq "") {
-		shift @$log;
-	}
-
-	# print log
-	my $signoff = 0;
-	my $empty = 0;
-	foreach my $line (@$log) {
-		# print only one empty line
-		# do not print empty line after signoff
-		if ($line eq "") {
-			next if ($empty || $signoff);
-			$empty = 1;
-		} else {
-			$empty = 0;
-		}
-		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
-			$signoff = 1;
-			print "<span class=\"signoff\">" . esc_html($line) . "</span><br/>\n";
-		} else {
-			$signoff = 0;
-			print format_log_line_html($line) . "<br/>\n";
-		}
-	}
-}
-
-sub git_print_simplified_log {
-	my $log = shift;
-	my $remove_title = shift;
-
-	shift @$log if $remove_title;
-	# remove leading empty lines
-	while (defined $log->[0] && $log->[0] eq "") {
-		shift @$log;
-	}
-
-	# simplify and print log
-	my $empty = 0;
-	foreach my $line (@$log) {
-		# remove signoff lines
-		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
-			next;
-		}
-		# print only one empty line
-		if ($line eq "") {
-			next if $empty;
-			$empty = 1;
-		} else {
-			$empty = 0;
-		}
-		print format_log_line_html($line) . "<br/>\n";
-	}
-	# end with single empty line
-	print "<br/>\n" unless $empty;
-}
-
 ## ......................................................................
 ## functions printing large fragments of HTML
 
@@ -1322,7 +1267,7 @@ sub git_difftree_body {
 			      "<td class=\"link\">" .
 				$cgi->a({-href => href(action=>"blob", hash=>$to_id, hash_base=>$hash, file_name=>$file)}, "blob");
 			if ($to_id ne $from_id) { # modified
-				print " | " . $cgi->a({-href => href(action=>"blobdiff", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$file)}, "diff");
+				print $cgi->a({-href => href(action=>"blobdiff", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$file)}, "diff");
 			}
 			print " | " . $cgi->a({-href => href(action=>"history", hash_base=>$hash, file_name=>$file)}, "history") . "\n";
 			print "</td>\n";
@@ -2215,10 +2160,27 @@ sub git_log {
 		      "<br/>\n" .
 		      "</div>\n" .
 		      "<i>" . esc_html($co{'author_name'}) .  " [$ad{'rfc2822'}]</i><br/>\n" .
-		      "</div>\n";
-
-		print "<div class=\"log_body\">\n";
-		git_print_simplified_log($co{'comment'});
+		      "</div>\n" .
+		      "<div class=\"log_body\">\n";
+		my $comment = $co{'comment'};
+		my $empty = 0;
+		foreach my $line (@$comment) {
+			if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
+				next;
+			}
+			if ($line eq "") {
+				if ($empty) {
+					next;
+				}
+				$empty = 1;
+			} else {
+				$empty = 0;
+			}
+			print format_log_line_html($line) . "<br/>\n";
+		}
+		if (!$empty) {
+			print "<br/>\n";
+		}
 		print "</div>\n";
 	}
 	git_footer_html();
@@ -2299,9 +2261,28 @@ sub git_commit {
 	}
 	print "</table>".
 	      "</div>\n";
-
 	print "<div class=\"page_body\">\n";
-	git_print_log($co{'comment'});
+	my $comment = $co{'comment'};
+	my $empty = 0;
+	my $signed = 0;
+	foreach my $line (@$comment) {
+		# print only one empty line
+		if ($line eq "") {
+			if ($empty || $signed) {
+				next;
+			}
+			$empty = 1;
+		} else {
+			$empty = 0;
+		}
+		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
+			$signed = 1;
+			print "<span class=\"signoff\">" . esc_html($line) . "</span><br/>\n";
+		} else {
+			$signed = 0;
+			print format_log_line_html($line) . "<br/>\n";
+		}
+	}
 	print "</div>\n";
 
 	git_difftree_body(\@difftree, $parent);
@@ -2367,7 +2348,29 @@ sub git_commitdiff {
 	git_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);
 	git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash);
 	print "<div class=\"page_body\">\n";
-	git_print_simplified_log($co{'comment'}, 1); # skip title
+	my $comment = $co{'comment'};
+	my $empty = 0;
+	my $signed = 0;
+	my @log = @$comment;
+	# remove first and empty lines after that
+	shift @log;
+	while (defined $log[0] && $log[0] eq "") {
+		shift @log;
+	}
+	foreach my $line (@log) {
+		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
+			next;
+		}
+		if ($line eq "") {
+			if ($empty) {
+				next;
+			}
+			$empty = 1;
+		} else {
+			$empty = 0;
+		}
+		print format_log_line_html($line) . "<br/>\n";
+	}
 	print "<br/>\n";
 	foreach my $line (@difftree) {
 		# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M      ls-files.c'
Signature · 1 line
1.4.1.1
#6 lore raw

Re: [PATCH 4/7] gitweb: Expand href() function to use key as param name for no mapping

Quoted 7 lines · Jakub Narebski

Expand href() function to use key name of params hash as a query param name, if there is no mapping for given key name.

It is now safer to use href(); no errors, but links might not work correctly if caller didn't provide correct arguments.

Future proofing.

I think that is not a "future proofing" but is "sweeping mess under the rug" ;-).

Quoted 30 lines
gitweb/gitweb.perl +0 -17
@@ -1174,66 +1179,6 @@ sub git_print_page_path {
 	}
 }
 
-sub git_print_log {
-	my $log = shift;
-
-	# remove leading empty lines
...
-}
-
-sub git_print_simplified_log {
-	my $log = shift;
-	my $remove_title = shift;
-
...
-	print "<br/>\n" unless $empty;
-}
-
 ## ......................................................................
 ## functions printing large fragments of HTML
...
@@ -2215,10 +2160,27 @@ sub git_log {
 		      "<br/>\n" .
 		      "</div>\n" .
 		      "<i>" . esc_html($co{'author_name'}) .  " [$ad{'rfc2822'}]</i><br/>\n" .
-		      "</div>\n";
-
-		print "<div class=\"log_body\">\n";
-		git_print_simplified_log($co{'comment'});

gitweb/gitweb.perl sub git_log { · line 2185

Quoted 10 lines
gitweb/gitweb.perl +7 -0
+		      "</div>\n" .
+		      "<div class=\"log_body\">\n";
...
+			print format_log_line_html($line) . "<br/>\n";
+		}
+		if (!$empty) {
+			print "<br/>\n";
+		}
 		print "</div>\n";
 	}

Obviously unrelated and probably unplanned revert of [2/7] in the series, so will not apply.

#7 lore raw

Re: [PATCH 4/7] gitweb: Expand href() function to use key as param name for no mapping

Quoted 5 lines · Junio C Hamano
Quoted 3 lines · Jakub Narebski

Expand href() function to use key name of params hash as a query param name, if there is no mapping for given key name.

Quoted 7 lines
Quoted 4 lines

It is now safer to use href(); no errors, but links might not work correctly if caller didn't provide correct arguments.

Future proofing.

I think that is not a "future proofing" but is "sweeping mess under the rug" ;-).

At least leave 'if (exists $mapping{$_})' even if you remove the 'else' part.

[...]

Quoted 2 lines

Obviously unrelated and probably unplanned revert of [2/7] in the series, so will not apply.

Ooops, sorry, I haven't noticed this... Very unplanned.

Signature · 1 line
Jakub Narebski
#8 lore raw

PATCH 5/7 gitweb: Added parse_difftree_raw_line function for later use

In reply to Jakub Narebski

Adds parse_difftree_raw_line function which parses one line of "raw" format diff-tree output into a hash.

For later use in git_difftree_body, git_commitdiff and git_commitdiff_plain, git_search.

---
 gitweb/gitweb.perl |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
gitweb/gitweb.perl +27 -0
index d37e7f1..b3f38bf 100755
@@ -851,6 +851,33 @@ sub parse_ref {
 	return %ref_item;
 }
 
+sub parse_difftree_raw_line {
+	my $line = shift;
+	my %res;
+
+	# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M	ls-files.c'
+	# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M	rev-tree.c'
+	if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/) {
+		$res{'from_mode'} = $1;
+		$res{'to_mode'} = $2;
+		$res{'from_id'} = $3;
+		$res{'to_id'} = $4;
+		$res{'status'} = $5;
+		$res{'similarity'} = $6;
+		if ($res{'status'} eq 'R' || $res{'status'} eq 'C') { # renamed or copied
+			($res{'from_file'}, $res{'to_file'}) = map(unquote, split("\t", $7));
+		} else {
+			$res{'file'} = unquote($7);
+		}
+	}
+	# 'c512b523472485aef4fff9e57b229d9d243c967f'
+	#elsif ($line =~ m/^([0-9a-fA-F]{40})$/) {
+	#	$res{'commit'} = $1;
+	#}
+
+	return wantarray ? %res : \%res;
+}
+
 ## ......................................................................
 ## parse to array of hashes functions
 
Signature · 1 line
1.4.1.1
#9 lore raw

Re: [PATCH 5/7] gitweb: Added parse_difftree_raw_line function for later use

gitweb/gitweb.perl sub parse_ref { · line 860

Quoted 7 lines · Jakub Narebski
gitweb/gitweb.perl +7 -0
+sub parse_difftree_raw_line {
+	my $line = shift;
+	my %res;
+
+	# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M	ls-files.c'
+	# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M	rev-tree.c'
+	if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/) {

We would probably want to say that status symbol is an uppercase alpha [A-Z]. Or maybe limit it to a non-whitespace letter (\S). Dot there to say "just any letter" looks wrong.

I would use "+" instead of hardcoding the length of mode strings (you have 6 there) and object name hash (ditto 40) but that is mostly style and a slight future proofing against us using longer hashes (not in our immediate future though).

#10 lore raw

PATCH 6/7 gitweb: Sort query string parameters in href() function

In reply to Jakub Narebski

Introduction of a href() function to generate an URL for the CGI, while making it easier to change the encoding of actions into URLs, changed also the ordering of parameters in query string, and in URL.

This patch tries to bring back old ordering of query string parameters. Probably it is not worth the cost; this is an RFC.

---
 gitweb/gitweb.perl |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +22 -1
index b3f38bf..d132aab 100755
@@ -197,8 +197,29 @@ sub href(%) {
 		hash_base => "hb",
 		page => "pg",
 		searchtext => "s",
+		order => "o",
 	);
 
+	my %ordering = (
+		project => 0,
+		action => 1,
+		order => 2,
+		hash => 10,
+		hash_parent => 11,
+		hash_base => 12,
+		page => 20,
+		file_name => 21,
+		searchtext => 22,
+	);
+
+	sub byordering ($$) {
+		if (exists $ordering{$_[0]} && exists $ordering{$_[1]}) {
+			return $ordering{$_[0]} <=> $ordering{$_[1]};
+		} else {
+			return $_[0] cmp $_[1];
+		}
+	}
+
 	my %params = @_;
 	$params{"project"} ||= $project;
 
@@ -210,7 +231,7 @@ sub href(%) {
 			} else {
 				"$_=$params{$_}";
 			}
-		} keys %params ) );
+		} sort byordering keys %params ) );
 
 	return $href;
 }
Signature · 1 line
1.4.1.1
#11 lore raw

PATCH 7/7 gitweb: Uniquify version info output, add meta generator in page header

In reply to Jakub Narebski
---
 gitweb/gitweb.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +2 -1
index d132aab..5467880 100755
@@ -1049,10 +1049,11 @@ sub git_header_html {
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
-<!-- git web interface v$version, (C) 2005-2006, Kay Sievers <kay.sievers\@vrfy.org>, Christian Gierke -->
+<!-- git web interface version $version, (C) 2005-2006, Kay Sievers <kay.sievers\@vrfy.org>, Christian Gierke -->
 <!-- git core binaries version $git_version -->
 <head>
 <meta http-equiv="content-type" content="$content_type; charset=utf-8"/>
+<meta name="generator" content="gitweb/$version git/$git_version"/>
 <meta name="robots" content="index, nofollow"/>
 <title>$title</title>
 <link rel="stylesheet" type="text/css" href="$stylesheet"/>
Signature · 1 line
1.4.1.1