]> git.ipfire.org Git - thirdparty/git.git/blobdiff - transport.c
Merge branch 'sg/t3420-autostash-fix'
[thirdparty/git.git] / transport.c
index b64b7bcb86f3c807d6a0dcd1dce26c7ee7fbb966..06ffea277460d68694aa4700b269601b56dd46ce 100644 (file)
@@ -139,7 +139,7 @@ static struct ref *get_refs_from_bundle(struct transport *transport,
                close(data->fd);
        data->fd = read_bundle_header(transport->url, &data->header);
        if (data->fd < 0)
-               die ("Could not read bundle '%s'.", transport->url);
+               die(_("could not read bundle '%s'"), transport->url);
        for (i = 0; i < data->header.references.nr; i++) {
                struct ref_list_entry *e = data->header.references.list + i;
                struct ref *ref = alloc_ref(e->name);
@@ -151,8 +151,7 @@ static struct ref *get_refs_from_bundle(struct transport *transport,
 }
 
 static int fetch_refs_from_bundle(struct transport *transport,
-                              int nr_heads, struct ref **to_fetch,
-                              struct ref **fetched_refs)
+                              int nr_heads, struct ref **to_fetch)
 {
        struct bundle_transport_data *data = transport->data;
        return unbundle(&data->header, data->fd,
@@ -288,8 +287,7 @@ static struct ref *get_refs_via_connect(struct transport *transport, int for_pus
 }
 
 static int fetch_refs_via_pack(struct transport *transport,
-                              int nr_heads, struct ref **to_fetch,
-                              struct ref **fetched_refs)
+                              int nr_heads, struct ref **to_fetch)
 {
        int ret = 0;
        struct git_transport_data *data = transport->data;
@@ -358,12 +356,8 @@ static int fetch_refs_via_pack(struct transport *transport,
        if (report_unmatched_refs(to_fetch, nr_heads))
                ret = -1;
 
-       if (fetched_refs)
-               *fetched_refs = refs;
-       else
-               free_refs(refs);
-
        free_refs(refs_tmp);
+       free_refs(refs);
        free(dest);
        return ret;
 }
@@ -662,7 +656,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
 
        switch (data->version) {
        case protocol_v2:
-               die("support for protocol v2 not implemented yet");
+               die(_("support for protocol v2 not implemented yet"));
                break;
        case protocol_v1:
        case protocol_v0:
@@ -788,7 +782,7 @@ static enum protocol_allow_config parse_protocol_config(const char *key,
        else if (!strcasecmp(value, "user"))
                return PROTOCOL_ALLOW_USER_ONLY;
 
-       die("unknown value for config '%s': %s", key, value);
+       die(_("unknown value for config '%s': %s"), key, value);
 }
 
 static enum protocol_allow_config get_protocol_config(const char *type)
@@ -854,7 +848,7 @@ int is_transport_allowed(const char *type, int from_user)
 void transport_check_allowed(const char *type)
 {
        if (!is_transport_allowed(type, -1))
-               die("transport '%s' not allowed", type);
+               die(_("transport '%s' not allowed"), type);
 }
 
 static struct transport_vtable bundle_vtable = {
@@ -883,7 +877,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
        ret->progress = isatty(2);
 
        if (!remote)
-               die("No remote provided to transport_get()");
+               BUG("No remote provided to transport_get()");
 
        ret->got_remote_refs = 0;
        ret->remote = remote;
@@ -906,7 +900,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
        if (helper) {
                transport_helper_init(ret, helper);
        } else if (starts_with(url, "rsync:")) {
-               die("git-over-rsync is no longer supported");
+               die(_("git-over-rsync is no longer supported"));
        } else if (url_is_local_not_ssh(url) && is_file(url) && is_bundle(url, 1)) {
                struct bundle_transport_data *data = xcalloc(1, sizeof(*data));
                transport_check_allowed("file");
@@ -1151,7 +1145,7 @@ int transport_push(struct transport *transport,
                                                      transport->push_options,
                                                      pretend)) {
                                oid_array_clear(&commits);
-                               die("Failed to push all needed submodules!");
+                               die(_("failed to push all needed submodules"));
                        }
                        oid_array_clear(&commits);
                }
@@ -1223,31 +1217,19 @@ const struct ref *transport_get_remote_refs(struct transport *transport,
        return transport->remote_refs;
 }
 
-int transport_fetch_refs(struct transport *transport, struct ref *refs,
-                        struct ref **fetched_refs)
+int transport_fetch_refs(struct transport *transport, struct ref *refs)
 {
        int rc;
        int nr_heads = 0, nr_alloc = 0, nr_refs = 0;
        struct ref **heads = NULL;
-       struct ref *nop_head = NULL, **nop_tail = &nop_head;
        struct ref *rm;
 
        for (rm = refs; rm; rm = rm->next) {
                nr_refs++;
                if (rm->peer_ref &&
                    !is_null_oid(&rm->old_oid) &&
-                   !oidcmp(&rm->peer_ref->old_oid, &rm->old_oid)) {
-                       /*
-                        * These need to be reported as fetched, but we don't
-                        * actually need to fetch them.
-                        */
-                       if (fetched_refs) {
-                               struct ref *nop_ref = copy_ref(rm);
-                               *nop_tail = nop_ref;
-                               nop_tail = &nop_ref->next;
-                       }
+                   !oidcmp(&rm->peer_ref->old_oid, &rm->old_oid))
                        continue;
-               }
                ALLOC_GROW(heads, nr_heads + 1, nr_alloc);
                heads[nr_heads++] = rm;
        }
@@ -1265,11 +1247,7 @@ int transport_fetch_refs(struct transport *transport, struct ref *refs,
                        heads[nr_heads++] = rm;
        }
 
-       rc = transport->vtable->fetch(transport, nr_heads, heads, fetched_refs);
-       if (fetched_refs && nop_head) {
-               *nop_tail = *fetched_refs;
-               *fetched_refs = nop_head;
-       }
+       rc = transport->vtable->fetch(transport, nr_heads, heads);
 
        free(heads);
        return rc;
@@ -1289,7 +1267,7 @@ int transport_connect(struct transport *transport, const char *name,
        if (transport->vtable->connect)
                return transport->vtable->connect(transport, name, exec, fd);
        else
-               die("Operation not supported by protocol");
+               die(_("operation not supported by protocol"));
 }
 
 int transport_disconnect(struct transport *transport)
@@ -1371,7 +1349,7 @@ static void read_alternate_refs(const char *path,
 
                if (get_oid_hex(line.buf, &oid) ||
                    line.buf[GIT_SHA1_HEXSZ] != ' ') {
-                       warning("invalid line while parsing alternate refs: %s",
+                       warning(_("invalid line while parsing alternate refs: %s"),
                                line.buf);
                        break;
                }