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

Re: gitweb.perl suggestion

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 8, 2010, 15:30 UTC
Message-ID
<m339vum1od.fsf@localhost.localdomain>
In-Reply-To
<19509.14862.368282.470934@winooski.ccs.neu.edu>
Eli Barzilay <eli@barzilay.org> writes:
Show 20 quoted lines
> Currently, if I go to
> 
>   http://server/gitweb/project/<commit-sha1>
> 
> I get to the shortlog page, which is not as useful as the commit
> page.  But changing this to have a default `commit' action isn't right
> either since the shortlog is more appropriate with
> 
>   http://server/gitweb/project/<commit-sha1>..<other-commit-sha1>
> 
> So how about changing this:
> 
>   $input_params{'action'} ||= "shortlog";
> 
> to this:
> 
>   $input_params{'action'} ||= ((defined $parentrefname) ? "shortlog" : "commit");
> 
> which will make the first case show the commit, and the second show
> the shortlog?
Thanks for noticing and informing about this issue.

Unfortunately for having a fast fixup, you have hit upon larger issue. Namely how gitweb guesses action if there isn't provided one.

Currently there is one set of rules for evaluate_path_info (used with path_info URL like e.g. http://server/gitweb/project/<sha1>), and another in dispath() after evaluating path info and query params (query params version would be http://server/gitweb?p=project;h=<sha1>).

  path_info                    | action
  -----------------------------+--------------------------
  object:dirname/              | tree
  object:filename              | blob_plain
  objectA..objectB:filename    | blobdiff_plain
  object                       | shortlog
  objectA..objectB             | shortlog
  query params                 | action
  -----------------------------+---------------------------
  h=object                     | git_get_type(object)
  hb=object;f=filename [*]     | git_get_type(object:filename)

[*] There is no optimization that if it ends in '/' it is 'tree' object, and if it is not, then it is 'blob' (file) object.

Finally if project is defined, default action is 'summary', and if it isn't then default action is 'project_list'.

So your proposed solution is good enough, but perhaps better would be to leave 'action' unset if there is no parent info? Then dispatch would guess action, instead of doing it in less sophisticated way in evaluate_path_info().

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Eli BarzilayNext: Eli Barzilay
Message 2 of 5 in “gitweb.perl suggestion”
  1. Eli BarzilayJul 8, 2010
  2. Jakub NarebskiJul 8, 2010
  3. Eli BarzilayJul 8, 2010
  4. Jakub NarebskiJul 8, 2010
  5. Eli BarzilayJul 8, 2010

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.