mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <>
To: Josh Triplett <>
Subject: Re: upload-pack/ls-remote: showing non-HEAD symbolic refs?
Date: Tue, 16 Aug 2016 12:31:45 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <20160816161838.klvjhhoxsftvkfmd@x>

On Tue, Aug 16, 2016 at 09:18:39AM -0700, Josh Triplett wrote:

> Commit 5e7dcad771cb873e278a0571b46910d7c32e2f6c in September 2013 added
> support to upload-pack to show the symbolic target of non-HEAD symbolic
> refs.  However, commit d007dbf7d6d647dbcf0f357545f43f36dec46f3b in
> November 2013 reverted that, because it used a capability to transmit
> the information, and capabilities have a limited size (limited by the
> pkt-line format which can't send lines longer than 64k) and can't
> transmit an arbitrary number of symrefs.
> (Incidentally, couldn't the same problem occur if the HEAD points to a
> long enough path to exceed 64k?

Yes. But it's a lot easier to say "your 64k symref is ridiculous; don't
do that" than it is to say "oh, you happened to have a lot of symrefs in
your repository, so we overflowed and failed".

Besides which, the whole protocol cannot handle refnames larger than
64k, so it's not a new problem.

> I'd like to be able to see the targets of non-HEAD symbolic refs for a
> repository (symbolic refs under refs/).  I'm interested in extending
> upload-pack to expose those somehow.  What seems like a sensible format
> to do so?
> Would it make sense to advertise a new capability for symbolic ref
> targets, which would allow the client to send back a dedicated request
> for the targets of all symrefs?

It will definitely require a new capability. You cannot just send a
"\0symref=..." trailer after each ref, because older clients treat
multiple "\0" trailers as overwriting one another (so it essentially
overwrites the old capabilities).

Sadly you cannot use a capability to fix that, because all of this
happens before the client agrees to any capabilities (you can find
discussion of a "v2" protocol on the list which solves this, but it's
sort of languishing in the design phase).

So you are stuck introducing a new phase into the protocol, which is
probably rather tricky (especially with the http protocol, which is very
sensitive to extra round-trips). I guess the least-invasive way would be
to communicate the desires in the "want" phase, and then have the server
dump it out with the packfile. Like:

  - server claims "I support symref-wants" in the capability phase

  - during the negotiation phase, in addition to "want" and "have", the
    client may send "symref <ref>" packets. Probably <ref> should be a
    wildcard to avoid having to ask about each ref individually.

  - before outputting the packfile in the final phase, if any "symref"
    wants were sent by the client, the server dumps a list of "symref
    <from> <to>" packets, followed by a flush packet.

That should Just Work over the existing http protocol without requiring
an extra request.


  reply	other threads:[~2016-08-16 16:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-16 16:18 upload-pack/ls-remote: showing non-HEAD symbolic refs? Josh Triplett
2016-08-16 16:31 ` Jeff King [this message]
2016-08-16 17:34   ` Josh Triplett
2016-08-16 18:28     ` Jeff King
2016-08-16 18:50       ` Stefan Beller
2016-08-16 20:34         ` Josh Triplett
2016-08-16 20:31       ` Josh Triplett
2016-08-16 20:54         ` Jeff King
2016-08-16 21:11           ` Josh Triplett
2016-08-16 21:15             ` Jeff King
2016-08-16 22:24               ` Josh Triplett
2016-08-19 13:47                 ` Jeff King

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:

  List information:

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

  git send-email \ \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).