All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jakub Narębski" <jnareb@gmail.com>
To: CLOSE Dave <Dave.Close@us.thalesgroup.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Complex gitweb URL
Date: Wed, 20 Jul 2016 23:20:30 +0200	[thread overview]
Message-ID: <578FEB1E.5060302@gmail.com> (raw)
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 '?').
> 
> 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


  reply	other threads:[~2016-07-20 21:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20 19:24 Complex gitweb URL CLOSE Dave
2016-07-20 21:20 ` Jakub Narębski [this message]
2016-07-20 21:35   ` CLOSE Dave
2016-07-20 21:50     ` Jakub Narębski
2016-07-20 21:46   ` CLOSE Dave
2016-07-23 17:47 ` Jakub Narębski
2016-07-25 16:34   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=578FEB1E.5060302@gmail.com \
    --to=jnareb@gmail.com \
    --cc=Dave.Close@us.thalesgroup.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.