On 15/06, Junio C Hamano wrote:
Johannes Löthberg <johan...@kyriasis.com> writes:
        else {
+               namespace = get_git_namespace();
+               if (strcmp(namespace, "refs/namespaces/")) {
+                       strbuf_addf(&namespaced_head_buf, "%s%s", namespace, 
"HEAD");
+                       namespaced_head_path = 
strbuf_detach(&namespaced_head_buf, NULL);
+
+                       create_symref(namespaced_head_path, namespaced_name, 
NULL);

In a normal environment without any namespace, get_git_namespace()
will return an empty string, which is not "refs/namespaces/", so we
create a symref HEAD (that is .git/HEAD) that points at whatever
name the command is about.  And this is done every time any ref is
updated, flipping the HEAD to point at whatever was pushed the last,
isn't it?

Why is this a good change?  I am puzzled...


This creates a HEAD symref in the namespace itself, since there's no other place that creates it. It could probably be done better, but I'm not very familiar with the Git codebase.

+               }
+
                struct strbuf err = STRBUF_INIT;

This adds decl-after-stmt.

Going back to the proposed log message...

Each ref namespace have their own separate branches, tags, and HEAD, so
when pushing to a namespace we need to make sure that there exists a
HEAD ref for the namespace, otherwise you will not be able to check out
the repo after cloning from a namespace

What this paragraph describes is entirely correct, I think.  But I
do not think receive-pack is the "we" in that paragraph.

When setting up a "namespace" a and b, shouldn't you be doing
essentially

        r=refs/namespaces/
        for ns in a b
       do
                git symbolic-ref $r$ns/HEAD $r$ns/refs/heads/master
        done

or something, which is an equivalent to what "git init" does to a
normal repository?


The only way to set up a namespace is by pushing to it.

--
Sincerely,
 Johannes Löthberg
 PGP Key ID: 0x50FB9B273A9D0BB5
 https://theos.kyriasis.com/~kyrias/

Attachment: signature.asc
Description: PGP signature

Reply via email to