git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: choose appropriate view for file type if a= parameter missing
Date: Sun, 13 May 2007 02:32:36 +0200	[thread overview]
Message-ID: <f25m2b$1b1$1@sea.gmane.org> (raw)
In-Reply-To: 20070510073207.21562.qmail@25d0c789693af2.315fe32.mid.smarden.org

<opublikowany i wysłany>

[Cc: Gerrit Pape <pape@smarden.org>, Junio C Hamano <junkio@cox.net>,
 git@vger.kernel.org]

Gerrit Pape wrote:

> this change would aid the creation of shortcuts to git repositories using
> simple substitution, such as:
> http://example.org/git/?p=path/to/repo.git;hb=HEAD;f=%s
> 
> With this patch, if given the hash through the h= parameter, or the hash
> base (hb=) and a filename (f=), gitweb uses cat-file -t to automatically set
> the a= parameter.

> -if (defined $project) {
> -     $action ||= 'summary';
> -} else {
> -     $action ||= 'project_list';
> +if (!defined $action) {
> +     if (defined $hash) {
> +             $action = git_get_type($hash);
> +     } elsif (defined $hash_base && defined $file_name) {
> +             $action = git_get_type("$hash_base:$file_name");
> +     } elsif (defined $project) {
> +             $action = 'summary';
> +     } else {
> +             $action = 'project_list';
> +     }

NOTE:

We have something similar for the only committag we support, namely
the shortened sha1 of object, which leads to an "object", which chooses
appropriate view using git_get_type / git-cat-file -t.

But contrary to the above solution it does it by creating a _redirect_
to a proper view, instead of silently selecting proper view like in
a patch above. Creating a redirect allows price for invoking 
git-cat-file -t to be paid only once. User would bookmark correct view.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

      parent reply	other threads:[~2007-05-13  0:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09 22:19 [PATCH] gitweb: choose appropriate view for file type if a= parameter missing Gerrit Pape
2007-05-10  2:04 ` Junio C Hamano
2007-05-10  7:32   ` Gerrit Pape
2007-05-10  7:43     ` Junio C Hamano
2007-05-13  0:32     ` Jakub Narebski [this message]

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='f25m2b$1b1$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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).