git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Josh Triplett <josh@joshtriplett.org>,
	John Koleszar <jkoleszar@google.com>,
	git@vger.kernel.org, Shawn Pearce <spearce@spearce.org>
Subject: Re: [PATCH] http-backend: respect GIT_NAMESPACE with dumb clients
Date: Fri, 5 Apr 2013 01:43:28 -0400	[thread overview]
Message-ID: <20130405054328.GA12705@sigill.intra.peff.net> (raw)
In-Reply-To: <7vobdtee12.fsf@alter.siamese.dyndns.org>

On Thu, Apr 04, 2013 at 10:34:49PM -0700, Junio C Hamano wrote:

> > +static void get_head(char *arg)
> > +{
> > +	struct strbuf buf = STRBUF_INIT;
> > +	head_ref_namespaced(show_text_ref, &buf);
> > +	send_strbuf("text/plain", &buf);
> > +	strbuf_release(&buf);
> > +}
> 
> You identified the right place to patch, but I think we need a bit
> more than this.
> 
> The show_text_ref() function gives "SHA-1 <TAB> refname". It is
> likely that the dumb client will ignore the trailing part of that
> output, but let's avoid a hack that we would not want see other
> implementations imitate.

Oh, right. I was thinking too much about normal clients which see HEAD
in the ref advertisement; of course the dumb client is expecting to see
the actual HEAD file.

> One advantage dumb clients has over smart ones is that they can read
> HEAD that is a textual symref from a dumb server and learn which
> branch is the default one (remote.c::guess_remote_head()) without
> guessing.  I think this function should:
> 
>  - Turn "HEAD" into a namespaced equivalent;
> 
>  - Run resolve_ref() on the result of the above;
> 
>  - Is it a symbolic ref?
> 
>    . If it is, then format "ref: <target>\n" into a strbuf and send
>      it (make sure <target> is without the namespace prefix);
> 
>    . Otherwise, HEAD is detached. Prepare "%s\n" % sha1_to_hex(sha1),
>      and send it.

Yes, that sounds right; it is basically just reconstructing a HEAD
file. What do the HEADs inside namespaces look like? Do they refer to
full global refs, or do they refer to refs within the namespace?

If the latter, we could just send the HEAD file directly. But I suspect
it is the former, so that they can function when non-namespaced commands
are used.

-Peff

  reply	other threads:[~2013-04-05  5:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28  4:58 [PATCH] http-backend: respect GIT_NAMESPACE with dumb clients John Koleszar
2013-03-28  6:02 ` Junio C Hamano
2013-03-28 15:49   ` Josh Triplett
2013-03-28 14:43 ` Junio C Hamano
     [not found]   ` <CAAvHm8NAqVHLz1wjNN-3ocpYzWfO-PDo0PAJ6pZO7KrMkhJ6Jw@mail.gmail.com>
2013-03-28 15:54     ` John Koleszar
2013-03-28 16:46       ` Junio C Hamano
2013-04-03 15:52       ` John Koleszar
2013-04-03 16:10         ` Jeff King
2013-04-03 16:16           ` Jeff King
2013-04-03 18:05             ` Junio C Hamano
2013-04-04 15:34               ` John Koleszar
2013-04-04 16:01                 ` John Koleszar
2013-04-04 17:25                   ` Junio C Hamano
2013-04-05  1:22                     ` John Koleszar
2013-04-05  2:35                       ` Josh Triplett
2013-04-05  2:56                         ` Jeff King
2013-04-05  5:34                           ` Junio C Hamano
2013-04-05  5:43                             ` Jeff King [this message]
2013-04-06  0:54                               ` John Koleszar
2013-04-10  0:55                                 ` [PATCH v4] " John Koleszar
2013-04-10  1:09                                   ` Junio C Hamano
2013-04-10  4:18                                   ` Jeff King
2013-04-08 21:25                   ` [PATCH] " Thomas Rast
2013-04-08 21:45                     ` Jeff King
2013-04-09 22:13                       ` John Koleszar
2013-04-03 18:04         ` 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=20130405054328.GA12705@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jkoleszar@google.com \
    --cc=josh@joshtriplett.org \
    --cc=spearce@spearce.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 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 NNTP newsgroup(s).