git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "Giuseppe Bilotta" <giuseppe.bilotta@gmail.com>
Cc: git@vger.kernel.org, "Petr Baudis" <pasky@ucw.cz>,
	"Lea Wiemann" <lewiemann@gmail.com>
Subject: Re: [PATCH 1/6] gitweb: action in path with use_pathinfo
Date: Tue, 30 Sep 2008 23:00:45 +0200	[thread overview]
Message-ID: <200809302300.46786.jnareb@gmail.com> (raw)
In-Reply-To: <cb7bb73a0809300553o7496f4c1me14ddf55b31fe4a6@mail.gmail.com>

On Tue, 30 September 2008, Giuseppe Bilotta wrote:
> On Tue, Sep 30, 2008 at 1:22 PM, Jakub Narebski <jnareb@gmail.com> wrote:
>> On Tue, 30 Sep 2008, Giuseppe "Oblomov" Bilotta wrote:
>>> On Tue, Sep 30, 2008 at 10:48 AM, Jakub Narebski <jnareb@gmail.com> wrote:

>>>> Or we could just scrap and revert adding href(..., -replay=>1).
>>>> There is much trouble with getting it right and performing well,
>>>> and it is less useful than I thought (at least now).
>>>
>>> Dunno, the idea in itself is not bad. We just have to get it right ;)
>>
>> It is not easy to get it right, especially that there are multivalued
>> parameters like @extra_options, see e.g. commit 7863c612
> 
> So we just let values be arrays. Or isn't this enough?

I don't think it would be that simple.


Let me elaborate a bit about complications and difficulties
within href() code.

First there are two names of parameters: the short name like 'a',
or 'h', or 'f' which is used in links to make them short (and
which is a bit historical legacy), and the long names like 'action',
'hash' or 'file_name' which are used for readability; then there are
also variables which hold values of parameters, like $action,
$hash and $file_name (which were source of long names for parameters).
href() has to provide translation between those two (well, three)
names; long names are used as names of "named parameters" to href(),
while short names are used when generating URL; %mapping provides
mapping between those two.

Second, href() must distinguish between gitweb options/parameters
like 'file_name'=>$file_name and extra options like '-full'=>1
or '-replay'=>1; additionally we want to have options output in
some definite order, with more important options first.  This
is provided by %mapping (to filter out) and @mapping (to sort).

Third, there are various sources of values of parameters, and
parameters used.  There are parameters specified explicitly in
href() call, and there are also implicit parameters: 'project'
parameter is implicitly added as it is needed in almost all
gitweb links (you can override it and generate projectless link by
using 'project'=>undef), and for '-replay'=>1 all parameters from
current URL are added.  Parameters specified explicitly have preference
over implicit or '-replay' ones.  

Now for '-replay' parameters might come from CGI query string, from
path_info part of URL, and perhaps in the future also from command
line.  To avoid duplicated code and other problems we should either
get parameters from variables (like in your code, but which doesn't
cover @extra_options well, but it could; or using "long name" to
variable ref mapping), or have some place where we save parameters
as we extract it from CGI query string, from path_info part of URL,
and in the future probably also from command line options/parameters.

Fourth, there is a little matter of _some_ parameters be multivalued;
currently it is only @extra_options / 'opt', but this may change in
the future, while _most_ are ordinary scalar values.  Printing arrayref
isn't something we want to do...


That is third and fourth which caused problems in the past with
href(..., -replay=>1)...

-- 
Jakub Narebski
Poland

  reply	other threads:[~2008-09-30 21:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-21 20:57 [PATCHv2 0/6] gitweb pathinfo improvements Giuseppe Bilotta
2008-09-21 20:57 ` [PATCH 1/6] gitweb: action in path with use_pathinfo Giuseppe Bilotta
2008-09-21 20:57   ` [PATCH 2/6] gitweb: use_pathinfo filenames start with / Giuseppe Bilotta
2008-09-21 20:57     ` [PATCH 3/6] gitweb: parse parent..current syntax from pathinfo Giuseppe Bilotta
2008-09-21 20:57       ` [PATCH 4/6] gitweb: use_pathinfo creates parent..current paths Giuseppe Bilotta
2008-09-21 20:57         ` [PATCH 5/6] gitweb: remove PATH_INFO from $my_url and $my_uri Giuseppe Bilotta
2008-09-21 20:57           ` [PATCH 6/6] gitweb: prevent double slashes in PATH_INFO hrefs Giuseppe Bilotta
2008-09-29 18:12             ` Jakub Narebski
2008-09-29  8:33           ` [PATCH 5/6] gitweb: remove PATH_INFO from $my_url and $my_uri Jakub Narebski
2008-09-29 13:05             ` Giuseppe Bilotta
2008-09-29  1:08     ` [PATCH 2/6] gitweb: use_pathinfo filenames start with / Jakub Narebski
2008-09-29 14:12       ` Giuseppe Bilotta
2008-09-29 23:20         ` Jakub Narebski
2008-09-30  7:48           ` Giuseppe Bilotta
2008-09-30 23:49             ` Jakub Narebski
2008-09-29  1:03   ` [PATCH 1/6] gitweb: action in path with use_pathinfo Jakub Narebski
2008-09-29 14:22     ` Giuseppe Bilotta
2008-09-30  0:21       ` Jakub Narebski
2008-09-30  8:05         ` Giuseppe Bilotta
2008-09-30  8:48           ` Jakub Narebski
2008-09-30 10:40             ` Giuseppe Bilotta
2008-09-30 11:22               ` Jakub Narebski
2008-09-30 12:53                 ` Giuseppe Bilotta
2008-09-30 21:00                   ` Jakub Narebski [this message]
2008-09-30 23:24               ` Jakub Narebski

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=200809302300.46786.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=giuseppe.bilotta@gmail.com \
    --cc=lewiemann@gmail.com \
    --cc=pasky@ucw.cz \
    /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).