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

Re: [PATCH 1/6] gitweb: action in path with use_pathinfo

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 30, 2008, 21:00 UTC
Message-ID
<200809302300.46786.jnareb@gmail.com>
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:
Show 10 quoted lines
>>>> 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
Previous: Giuseppe BilottaNext: Jakub Narebski
Message 24 of 25 in “[PATCHv2 0/6] gitweb pathinfo improvements”
  1. Giuseppe BilottaSep 21, 2008
  2. 1/6 gitweb: action in path with use_pathinfoGiuseppe Bilotta, Sep 21, 2008
  3. 2/6 gitweb: use_pathinfo filenames start with /Giuseppe Bilotta, Sep 21, 2008
  4. 3/6 gitweb: parse parent..current syntax from pathinfoGiuseppe Bilotta, Sep 21, 2008
  5. 4/6 gitweb: use_pathinfo creates parent..current pathsGiuseppe Bilotta, Sep 21, 2008
  6. 5/6 gitweb: remove PATH_INFO from $my_url and $my_uriGiuseppe Bilotta, Sep 21, 2008
  7. 6/6 gitweb: prevent double slashes in PATH_INFO hrefsGiuseppe Bilotta, Sep 21, 2008
  8. Jakub NarebskiSep 29, 2008
  9. Jakub NarebskiSep 29, 2008
  10. Giuseppe BilottaSep 29, 2008
  11. Jakub NarebskiSep 29, 2008
  12. Giuseppe BilottaSep 29, 2008
  13. Jakub NarebskiSep 29, 2008
  14. Giuseppe BilottaSep 30, 2008
  15. Jakub NarebskiSep 30, 2008
  16. Jakub NarebskiSep 29, 2008
  17. Giuseppe BilottaSep 29, 2008
  18. Jakub NarebskiSep 30, 2008
  19. Giuseppe BilottaSep 30, 2008
  20. Jakub NarebskiSep 30, 2008
  21. Giuseppe BilottaSep 30, 2008
  22. Jakub NarebskiSep 30, 2008
  23. Giuseppe BilottaSep 30, 2008
  24. Jakub NarebskiSep 30, 2008
  25. Jakub NarebskiSep 30, 2008

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.