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

[PATCH 5/5] gitweb: Change appereance of marker of refs pointing to given object

From
Jakub Narebski <jnareb@gmail.com>
Date
Aug 4, 2006, 22:43 UTC
Message-ID
<200608050043.18420.jnareb@gmail.com>
In-Reply-To
<200608050036.06490.jnareb@gmail.com>

Change default value of $type in git_read_info_refs to correctly show full name of ref (and not only last part) if $type was not set.

Refs are now in separate span elements. Class was changed from "tag" to "ref", as ref can be head, not only tag. Currently there is no way to distinguish between tags and heads.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.css  |    2 +-
 gitweb/gitweb.perl |   12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index 460e728..921b339 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -317,7 +317,7 @@ a.rss_logo:hover {
 	background-color: #ee5500;
 }
 
-span.tag {
+span.ref {
 	padding: 0px 4px;
 	font-size: 10px;
 	font-weight: normal;
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 9e4822b..e983452 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -350,9 +350,13 @@ sub format_mark_referencing {
 	my ($refs, $id) = @_;
 
 	if (defined $refs->{$id}) {
-		return ' <span class="tag">' . esc_html($refs->{$id}) . '</span>';
+		my $markers = '';
+		foreach my $ref (split /:/, $refs->{$id}) {
+			$markers .= ' <span class="ref">' . esc_html($ref) . '</span>';
+		}
+		return $markers;
 	} else {
-		return "";
+		return '';
 	}
 }
 
@@ -496,7 +500,7 @@ sub git_read_projects {
 }
 
 sub git_read_info_refs {
-	my $type = shift || "";
+	my $type = shift || "(?:heads|tags)";
 	my %refs;
 	# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c	refs/tags/v2.6.11
 	# c39ae07f393806ccf406ef966e9a15afc43cc36a	refs/tags/v2.6.11^{}
@@ -507,7 +511,7 @@ sub git_read_info_refs {
 		# e.g. from 'refs/heads/jn/gitweb' it would leave only 'gitweb'
 		if ($line =~ m/^([0-9a-fA-F]{40})\t.*$type\/([^\^]+)/) {
 			if (defined $refs{$1}) {
-				$refs{$1} .= " / $2";
+				$refs{$1} .= ':' . $2;
 			} else {
 				$refs{$1} = $2;
 			}
-- 
1.4.1.1
Previous: Jakub NarebskiNext: Jakub Narebski
Message 23 of 26 in “Some further gitweb patches”
  1. 0/5 Some further gitweb patchesJakub Narebski, Aug 4, 2006
  2. 1/5 gitweb: Cleanup input validation and error messagesJakub Narebski, Aug 4, 2006
  3. Luben TuikovAug 4, 2006
  4. 6/5 gitweb: No periods for error messagesJakub Narebski, Aug 5, 2006
  5. Luben TuikovAug 4, 2006
  6. Junio C HamanoAug 5, 2006
  7. Jakub NarebskiAug 5, 2006
  8. 0/9 gitweb: First patch corrected and split into separate patchesJakub Narebski, Aug 5, 2006
  9. 1/9 gitweb: Separate input validation and dispatch, add comment about opml actionJakub Narebski, Aug 5, 2006
  10. 2/9 gitweb: die_error first (optional) parameter is HTTP statusJakub Narebski, Aug 5, 2006
  11. 3/9 gitweb: Use undef for die_error to use default first (status) parameter valueJakub Narebski, Aug 5, 2006
  12. 4/9 gitweb: Don't undefine query parameter related variables before die_errorJakub Narebski, Aug 5, 2006
  13. 5/9 gitweb: Cleanup and uniquify error messagesJakub Narebski, Aug 5, 2006
  14. 6/9 gitweb: No periods for error messagesJakub Narebski, Aug 5, 2006
  15. Luben TuikovAug 5, 2006
  16. Jakub NarebskiAug 5, 2006
  17. 7/9 gitweb: No error messages with unescaped/unprotected user inputJakub Narebski, Aug 5, 2006
  18. 8/9 gitweb: PATH_INFO=/ means no projectJakub Narebski, Aug 5, 2006
  19. 9/9 gitweb: Inline $rss_linkJakub Narebski, Aug 5, 2006
  20. 2/5 gitweb: Great subroutines renamingJakub Narebski, Aug 4, 2006
  21. 3/5 gitweb: Separate ref parsing in git_read_refs into parse_refJakub Narebski, Aug 4, 2006
  22. 4/5 gitweb: git_heads cleanupJakub Narebski, Aug 4, 2006
  23. 5/5 gitweb: Change appereance of marker of refs pointing to given objectJakub Narebski, Aug 4, 2006
  24. 7/5 Merge changes in "split patch 1" seriesJakub Narebski, Aug 5, 2006
  25. Johannes SchindelinAug 5, 2006
  26. Jakub NarebskiAug 5, 2006

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.