Jeff King <> writes:

> Yeah, that makes sense. I think we'd want something like the (totally
> untested) patch below. And the tests I provided for t5551 should be
> amended to set up a HEAD within the namespace, should make the resulting
> clone non-bare, and should confirm that we check out the correct HEAD.
> diff --git a/http-backend.c b/http-backend.c
> index 8144f3a..84ba7f9 100644
> --- a/http-backend.c
> +++ b/http-backend.c
> @@ -376,6 +376,14 @@ static int show_text_ref(const char *name, const 
> unsigned char *sha1,
>       return 0;
>  }
> +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.

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.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to