Merge branch 'jk/HEAD-symref-in-xfer-namespaces' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Jul 2019 21:27:09 +0000 (14:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Jul 2019 21:27:09 +0000 (14:27 -0700)
The server side support for "git fetch" used to show incorrect
value for the HEAD symbolic ref when the namespace feature is in
use, which has been corrected.

* jk/HEAD-symref-in-xfer-namespaces:
upload-pack: strip namespace from symref data

1  2 
upload-pack.c
diff --combined upload-pack.c
index 24298913c0d7932e20f4677d3b8a4ea62ed69f8d,7fa501cb4d26f331fdf29e8b0dc93c1f741f7f1f..4d2129e7fc134cdbc67e08ce9fb4f805023059b5
@@@ -592,8 -592,7 +592,8 @@@ error
        return 1;
  }
  
 -static void check_non_tip(struct object_array *want_obj)
 +static void check_non_tip(struct object_array *want_obj,
 +                        struct packet_writer *writer)
  {
        int i;
  
@@@ -612,13 -611,9 +612,13 @@@ error
        /* Pick one of them (we know there at least is one) */
        for (i = 0; i < want_obj->nr; i++) {
                struct object *o = want_obj->objects[i].item;
 -              if (!is_our_ref(o))
 +              if (!is_our_ref(o)) {
 +                      packet_writer_error(writer,
 +                                          "upload-pack: not our ref %s",
 +                                          oid_to_hex(&o->oid));
                        die("git upload-pack: not our ref %s",
                            oid_to_hex(&o->oid));
 +              }
        }
  }
  
@@@ -839,7 -834,7 +839,7 @@@ static int process_deepen_not(const cha
        if (skip_prefix(line, "deepen-not ", &arg)) {
                char *ref = NULL;
                struct object_id oid;
 -              if (expand_ref(arg, strlen(arg), &oid, &ref) != 1)
 +              if (expand_ref(the_repository, arg, strlen(arg), &oid, &ref) != 1)
                        die("git upload-pack: ambiguous deepen-not: %s", line);
                string_list_append(deepen_not, ref);
                free(ref);
@@@ -941,7 -936,7 +941,7 @@@ static void receive_needs(struct packet
         * by another process that handled the initial request.
         */
        if (has_non_tip)
 -              check_non_tip(want_obj);
 +              check_non_tip(want_obj, &writer);
  
        if (!use_sideband && daemon_mode)
                no_progress = 1;
@@@ -1037,8 -1032,8 +1037,8 @@@ static int find_symref(const char *refn
        symref_target = resolve_ref_unsafe(refname, 0, NULL, &flag);
        if (!symref_target || (flag & REF_ISSYMREF) == 0)
                die("'%s' is a symref but it is not?", refname);
-       item = string_list_append(cb_data, refname);
-       item->util = xstrdup(symref_target);
+       item = string_list_append(cb_data, strip_namespace(refname));
+       item->util = xstrdup(strip_namespace(symref_target));
        return 0;
  }
  
@@@ -1069,8 -1064,6 +1069,8 @@@ static int upload_pack_config(const cha
                allow_ref_in_want = git_config_bool(var, value);
        } else if (!strcmp("uploadpack.allowsidebandall", var)) {
                allow_sideband_all = git_config_bool(var, value);
 +      } else if (!strcmp("core.precomposeunicode", var)) {
 +              precomposed_unicode = git_config_bool(var, value);
        }
  
        if (current_config_scope() != CONFIG_SCOPE_REPO) {