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

Re: [PATCH] gitweb: Different colours for tags and heads

From
Junio C Hamano <junkio@cox.net>
Date
Aug 11, 2006, 21:50 UTC
Message-ID
<7vodurrlg8.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<ebi81l$qu$1@sea.gmane.org>
Jakub Narebski <jnareb@gmail.com> writes:
Show 6 quoted lines
> By the way, please do not put "Hello," in the commit message
> part of patch. You can put your comments (like which branch
> and/or commit is the batch based on) either after "---" and
> before the patch itself, or at the beginning and separate them
> from the commit message by "+++" (this separator is supported
> by git tools,...
???
Show 6 quoted lines
> I've planned on patch which does something similar to
> yours, but in slightly different way: instead of two calls 
> to git_get_referencing (format_mark_referencing[*1*] after rename)
> and two calls to read_info_ref (git_get_references after rename)
> in your patch, read_info_ref would always add full name, of
> which first component is the type of the tag.
get_referencing to get, and format_ref to format perhaps?
> I am wondering if to do this like in my abovementioned patch,
> putting references in single string, separated by ':' (':' cannot
> be part of valid ref name), or use array (anonymous array reference
> to be more exact). 
Two things and half come to mind.

get_referencing could get and return the full refname without abbreviation ('heads/jn/web' or 'tags/v1.0'), and the caller can do whatever with them (e.g. see what the name begins with to tell heads and tags apart). This is probably the most flexible if we do not want to cast the categorization of refs in stone.

Otherwise, return an arrayref, like ['tag', 'v1.0', 'v1.0'] or ['head', 'web', 'jn/web'], to say what kind, short name and full name.

I've always wondered if the span that shows the short refname could have an on-hover pop-up (title attribute is often shown that way) to show the full name. Then you could do something like:

    $long_name = 'heads/jn/web'; # or 'tags/v1.0'
    $kind = ($long_name =~ /^heads/) ? 'head' : 'tag';
    $long_name = s|^[^/]*/||;
    ($short_name = $long_name) =~ s|.*/||;
    $long_name = esc_html($long_name);
    $short_name = esc_html($short_name);
    return " <span class='$kind' title='$long_name'>$short_name</span>";
Previous: Jakub NarebskiNext: Jakub Narebski
Message 3 of 6 in “gitweb: Different colours for tags and heads”
  1. gitweb: Different colours for tags and headsThomas Kolejka, Aug 11, 2006
  2. Jakub NarebskiAug 11, 2006
  3. Junio C HamanoAug 11, 2006
  4. Jakub NarebskiAug 12, 2006
  5. Junio C HamanoAug 12, 2006
  6. Martin WaitzAug 14, 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.