]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/receive-pack.c
i18n: avoid parenthesized string as array initializer
[thirdparty/git.git] / builtin / receive-pack.c
index d634b5a3d5212b8e49217d94430c294b911dfc7d..e1ba4dc697abd1b2582713744c5a1892ef4a4882 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "builtin.h"
 #include "pack.h"
 #include "refs.h"
 #include "pkt-line.h"
@@ -530,7 +530,7 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)
 static void check_aliased_updates(struct command *commands)
 {
        struct command *cmd;
-       struct string_list ref_list = { NULL, 0, 0, 0 };
+       struct string_list ref_list = STRING_LIST_INIT_NODUP;
 
        for (cmd = commands; cmd; cmd = cmd->next) {
                struct string_list_item *item =
@@ -731,43 +731,14 @@ static int delete_only(struct command *commands)
        return 1;
 }
 
-static int add_refs_from_alternate(struct alternate_object_database *e, void *unused)
+static void add_one_alternate_ref(const struct ref *ref, void *unused)
 {
-       char *other;
-       size_t len;
-       struct remote *remote;
-       struct transport *transport;
-       const struct ref *extra;
-
-       e->name[-1] = '\0';
-       other = xstrdup(make_absolute_path(e->base));
-       e->name[-1] = '/';
-       len = strlen(other);
-
-       while (other[len-1] == '/')
-               other[--len] = '\0';
-       if (len < 8 || memcmp(other + len - 8, "/objects", 8))
-               return 0;
-       /* Is this a git repository with refs? */
-       memcpy(other + len - 8, "/refs", 6);
-       if (!is_directory(other))
-               return 0;
-       other[len - 8] = '\0';
-       remote = remote_get(other);
-       transport = transport_get(remote, other);
-       for (extra = transport_get_remote_refs(transport);
-            extra;
-            extra = extra->next) {
-               add_extra_ref(".have", extra->old_sha1, 0);
-       }
-       transport_disconnect(transport);
-       free(other);
-       return 0;
+       add_extra_ref(".have", ref->old_sha1, 0);
 }
 
 static void add_alternate_refs(void)
 {
-       foreach_alt_odb(add_refs_from_alternate, NULL);
+       foreach_alt_odb(refs_from_alternate_cb, add_one_alternate_ref);
 }
 
 int cmd_receive_pack(int argc, const char **argv, const char *prefix)
@@ -778,6 +749,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
        char *dir = NULL;
        struct command *commands;
 
+       packet_trace_identity("receive-pack");
+
        argv++;
        for (i = 1; i < argc; i++) {
                const char *arg = *argv++;