Re: [PATCH] gitweb: choose appropriate view for file type if a= parameter missing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<opublikowany i wysłany>

[Cc: Gerrit Pape <pape@xxxxxxxxxxx>, Junio C Hamano <junkio@xxxxxxx>,
 git@xxxxxxxxxxxxxxx]

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


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux