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 23, 2016, 17:47 UTC
Message-ID
<5793ADAC.6030009@gmail.com>
In-Reply-To
<225e6ff4-178c-cd2a-6a05-b621f0ad4a84@us.thalesgroup.com>
W dniu 2016-07-20 o 21:24, CLOSE Dave pisze:
> I'm trying to create a URL that will always refer to the latest version 
> of a file stored under Gerrit. gitweb access is available. The man page 
> specification doesn't seem to work for me. Instead, I seem to need to 
> put most of the information into arguments (after the '?').
[...]
> 
> Are these arguments documented somewhere? What is the recommended way to 
> construct a URL like I need?

Actually it turns out that gitweb URLs are described in gitweb(1) manpage https://git.github.io/htmldocs/gitweb.html#_actions_and_urls in the "Actions, and URLs" section.

What was missing was explanation of available query parameters (the URL arguments after the '?'). Would the following patch help, or is it still missing something (NOTE: not tested)?:

----- >8 ------------------------------------------------------ >8 -----
Subject: [PATCH] gitweb(1): Document query parameters
The gitweb manpage includes description of gitweb URL structure,
but it was limited to passing parameters in the path part of URL
('path info'), and it didn't include explanation of query parameters.
---
 Documentation/gitweb.txt | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
diff --git a/Documentation/gitweb.txt b/Documentation/gitweb.txt
index 96156e5..301003f 100644
--- a/Documentation/gitweb.txt
+++ b/Documentation/gitweb.txt
@@ -395,6 +395,43 @@ atom::
 	Generates an RSS (or Atom) feed of changes to repository.
 
 
+Query parameters:
+~~~~~~~~~~~~~~~~~
+In some cases gitweb cannot pass a parameter in path part of URL, for
+example if a filename contains double dots ('..') inside.  All parameters
+that cannot be passed in that way are put as a query parameter, that is
+after '?'.
+
+By default gitweb would generate links using query parameters, unless
+the original URL was using path part, or gitweb was configured to use
+pathinfo with the 'pathinfo' feature. All gitweb installations recognize
+URL in either format, so you can use one that is better for you when
+interacting with gitweb (handcrafting or editing URLs, or creating
+a program interacting with gitweb installation).
+
+Here is the list of some of query parameters, together with their
+long names (which should help remembering the short name of
+each parameter):
+
+'a' (action)::
+	The action that will be run.
+
+'p' (project)::
+	The project repository that will be displayed.
+
+'h' (hash)::
+	The object id of displayed object (commit, tag, tree, blob).
+	In case of files 'hb' (hash_base) and 'f' (filename) might be
+	used instead.
+
+'hp' (hash_parent)::
+'fp' (file_parent)::
+'hpb' (hash_parent_base)::
+      Those parameters define the second object for diff-like actions,
+      the object gitweb is comparing againts.
+
+
+
 WEBSERVER CONFIGURATION
 -----------------------
 This section explains how to configure some common webservers to run gitweb. In
-- 
2.6.3
Previous: CLOSE DaveNext: Junio C Hamano
Message 6 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.