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

Re: [PATCH] gitweb: ref markers link to named shortlogs

From
Jakub Narebski <jnareb@gmail.com>
Date
Aug 21, 2008, 21:32 UTC
Message-ID
<200808212332.07095.jnareb@gmail.com>
In-Reply-To
<1219341860-4913-1-git-send-email-giuseppe.bilotta@gmail.com>
On Thu, 21 Aug 2008, Giuseppe Bilotta wrote:
Show 6 quoted lines
> This patch turns ref markers for tags and heads into links to
> appropriate views for the ref name. Appropriate changes are made in the
> CSS to prevent ref markers to be annoyingly blue and underlined.
> 
> For all git ref types it's assumed that the preferred view is named like
> the ref type itself. For commits, we map the view to shortlog.
NAK.
It is a good idea, but not so good solution.
> --- a/gitweb/gitweb.css
> +++ b/gitweb/gitweb.css
> +span.refs span a {
> +	text-decoration: none;
> +	color: inherit;
> +}
Possible improvement:

We would probably want to make this link discoverable, by adding underline on :hover, like for other "hidden links" in gitweb (for example in commitdiff view).

Show 19 quoted lines
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 90cd99b..a12ce87 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -1093,10 +1093,14 @@ sub format_log_line_html {
>  sub format_ref_marker {
>  	my ($refs, $id) = @_;
>  	my $markers = '';
> +	my %view = (
> +		"commit" => "shortlog",
> +	);
>  
>  	if (defined $refs->{$id}) {
>  		foreach my $ref (@{$refs->{$id}}) {
>  			my ($type, $name) = qw();
> +			my $git_type = git_get_type($ref);
>  			# e.g. tags/v2.6.11 or heads/next
>  			if ($ref =~ m!^(.*?)s?/(.*)$!) {
>  				$type = $1;

git_get_type calls 'git cat-file -t', so for each ref shown you make *additional call* to git command (additional fork). Not good, especially that you can get information if a ref is a tag (indirect reference) or not one can get from within git_get_references; which in turn uses "git show-refs --dereference" and used to use either "git peek-remote ." or ".git/info/refs" file. If there is <name>^{}, then <name> is indirect reference: is a tag.

As we display ref markers only for log-like views, marker can be tag or can be "lightweight reference" and be only a commit (in theory we could show ref markers also for tree and blob items, but it is not important now).

-- 
Jakub Narebski
Poland
Previous: Giuseppe BilottaNext: Giuseppe Bilotta
Message 2 of 33 in “gitweb: ref markers link to named shortlogs”
  1. gitweb: ref markers link to named shortlogsGiuseppe Bilotta, Aug 21, 2008
  2. Jakub NarebskiAug 21, 2008
  3. Giuseppe BilottaAug 22, 2008
  4. Jakub NarebskiAug 22, 2008
  5. [PATCHv3] gitweb: ref markers link to named shortlogsGiuseppe Bilotta, Aug 22, 2008
  6. Lea WiemannAug 24, 2008
  7. Giuseppe BilottaAug 24, 2008
  8. Jakub NarebskiAug 24, 2008
  9. Giuseppe BilottaAug 25, 2008
  10. Jakub NarebskiAug 26, 2008
  11. Giuseppe BilottaAug 26, 2008
  12. Jakub NarebskiAug 26, 2008
  13. Giuseppe BilottaAug 26, 2008
  14. Giuseppe BilottaAug 27, 2008
  15. Lea WiemannAug 28, 2008
  16. Giuseppe BilottaAug 28, 2008
  17. Jakub NarebskiAug 28, 2008
  18. Jakub NarebskiAug 22, 2008
  19. Giuseppe BilottaAug 22, 2008
  20. gitweb: ref markers link to named shortlogsGiuseppe Bilotta, Aug 22, 2008
  21. Jakub NarebskiAug 22, 2008
  22. Giuseppe BilottaAug 22, 2008
  23. Jakub NarebskiAug 22, 2008
  24. Giuseppe BilottaAug 22, 2008
  25. gitweb: ref markers link to named shortlogsGiuseppe Bilotta, Aug 22, 2008
  26. Jakub NarebskiAug 24, 2008
  27. Miklos VajnaAug 25, 2008
  28. Jakub NarebskiAug 25, 2008
  29. Junio C HamanoAug 25, 2008
  30. Jakub NarebskiAug 25, 2008
  31. Junio C HamanoAug 25, 2008
  32. gitweb: ref markers link to named shortlogsGiuseppe Bilotta, Aug 26, 2008
  33. gitweb: ref markers link to named shortlogsGiuseppe Bilotta, Aug 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.