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

Re: Complex gitweb URL

From
Jakub Narębski <jnareb@gmail.com>
Date
Jul 20, 2016, 21:50 UTC
Message-ID
<CANQwDwe4OvNx+3uOG6Qbzj1CKK+N-pvTyk_j2WxDs-R2LPv3YQ@mail.gmail.com>
In-Reply-To
<42f9c384-489d-3fce-2b27-8884e683a3d5@us.thalesgroup.com>
On 20 July 2016 at 23:35, CLOSE Dave <Dave.Close@us.thalesgroup.com> wrote:
Show 11 quoted lines
> Thanks, Jakub, for the quick response.
>
> On 07/20/16 02:20 PM, Jakub Narębski wrote:
>
>>> If I replace the hb=SHA argument with hb=HEAD, the URL still works. But
>>> I have no idea what I can use to replace the h=SHA argument.
>>
>> You can remove it.  'hb' (hash_base) and 'f' (filename) identify target
>> file in a repository unambiguously.
>
> If I do, leaving everything else present, I get "404 cannot find file".

Which gitweb version are you using? For 'a=blob' (i.e. displaying contents of the file), if 'h' (hash) parameter is not set, then gitweb finds it by using `git ls-tree <hash_base> -- <filename>` in git_get_hash_by_path() subroutine. No 'hb' is equivalent to 'hb=HEAD'

What does `git ls-tree <hash_base> -- <filename>` results in your repository?

Show 10 quoted lines
>>> A complication is that the target file is not in the master branch.
>>> Somehow I need to be able to specify the branch. I've tried putting it
>>> as the h= argument but that results in "Reading blob failed". If I leave
>>> out the h= argument entirely, gitweb responds, "404 cannot find file".
>>
>> Did you forgot to set 'hb' parameter?  Is said file present in revision
>> given by the 'hb' parameter?
>
> The file is present in both master and develop branches. If I include
> hb=HEAD and leave out h=, gitweb doesn't find either of them.

It works for repo.or.cz (which uses gitweb as web interface). So we have WORKSFORME situation. Now we need to find out what is different in your case...

>                                                                                            Using
> hb=HEAD and h=develop or h=master results in "Reading blob failed".
'h' must be hash of the blob as an abject (of its contents at given revision).
-- 
Jakub Narebski
Previous: CLOSE DaveNext: CLOSE Dave
Message 4 of 7 in “Complex gitweb URL”
  1. CLOSE DaveJul 20, 2016
  2. Jakub NarębskiJul 20, 2016
  3. CLOSE DaveJul 20, 2016
  4. Jakub NarębskiJul 20, 2016
  5. CLOSE DaveJul 20, 2016
  6. Jakub NarębskiJul 23, 2016
  7. Junio C HamanoJul 25, 2016

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.