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 '?'). > > For example, the repo name includes several directories, so it doesn't > work to put it into the > ".../gitweb.cgi/<repo>/<action>/<revision>:/<path>?<arguments>" format. > Or, at least, I don't see how. The fact that gitweb path_info-based URL uses <repo>/<action>... instead of <action>/<repo> is in my opinion a bit of an unfortunate design error, kept because of backward compatibility. That said, gitweb can detect where the <repo> part ends and <action> part begins, even for hierarchical multi-part repository name. See e.g. http://repo.or.cz/git/zerocommit.git/tree/HEAD:/Documentation with repository part being 'git/zerocommit.git' (a "fork" of git.git). So it should work. There are some cases however where the URL cannot be represented in path_info form, and some parameters must be put as query arguments, i.e. after '?'. > > Instead I'm trying to use a URL in the format, > "http://site/gitweb/?args". If I use gitweb itself to navigate to my > target file, I see a URL in this format that contains several arguments, > "p=repo;a=blob;f=file;h=SHA;hb=SHA". If I use that URL directly, I get > my file. But those SHA values are not something I know how to determine > in advance. And I suspect they are unique to the specific version of the > file accessed, not always the latest as I want. > > 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. > > 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? See e.g. http://repo.or.cz/?p=git/zerocommit.git;a=tree;hb=master;f=t > Are these arguments documented somewhere? What is the recommended way to > construct a URL like I need? Well, they are not described in the documentation, but you can check the code and its comments. Best, -- Jakub Narębski -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html