Re: [PATCH] gitweb: ref markers link to named shortlogs
From: Jakub Narebski <hidden>
Date: 2016-06-15 22:45:12
On Thu, 21 Aug 2008, Giuseppe Bilotta wrote:
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.
quoted hunk ↗ jump to hunk
--- 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).
quoted hunk ↗ jump to hunk
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