All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: Different colours for tags and heads
Date: Sat, 12 Aug 2006 02:12:19 +0200	[thread overview]
Message-ID: <ebj6c3$4cj$1@sea.gmane.org> (raw)
In-Reply-To: 7vodurrlg8.fsf@assigned-by-dhcp.cox.net

Junio C Hamano wrote:

> Jakub Narebski <jnareb@gmail.com> writes:

>> 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?

Thanks for a suggestion. I've decided on git_get_references, and
format_ref_marker,but it isn't cast in stone.
 
>> 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.

Perhaps I have not said things clearly. The problem I meant to solve is the
fact that there might be more than one ref pointing to a given object.
Currently read_info_ref does not its job joining references pointing to
given object (referenced object is key of a hash) using " / ", i.e.
creating the "joined tag".

In dropped patch I've mentioned I joined references using ':' as it can't be
part of valid ref name, then split it on ':' on formatting.

But they can be put into anonymous arrayref (e.g. ['heads/next',
'heads/autoconf'] at the start of 'autoconf' branch, or ['heads/master',
'heads/next', 'tags/v1.4.2'], not 'heads/master:heads/next:tags/v1.4.2'
my patch did.

> 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>";

Currently (in core-git) besides 'heads' and 'tags' there might be
'remotes' (when using --use-separate-remote' option of git-clone), all
following the rule of being plural (in English) to the type of tag, so one
could use
        $ref =~ m|(^[^/])*s?/|;
        $kind = $1;
for kind.

By the way, is it really usefull to have shortened ref name, e.g. 'web' for
'jn/web'? That is what gitweb does currently (only without giving ling name
at all). It is probably bad practice, but I've had branches ab/sth and
zz/sth, with the same shortname.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

  reply	other threads:[~2006-08-12  0:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-11 15:12 [PATCH] gitweb: Different colours for tags and heads Thomas Kolejka
2006-08-11 15:34 ` Jakub Narebski
2006-08-11 21:50   ` Junio C Hamano
2006-08-12  0:12     ` Jakub Narebski [this message]
2006-08-12  0:58       ` Junio C Hamano
2006-08-14  5:22     ` Martin Waitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ebj6c3$4cj$1@sea.gmane.org' \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.