X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=upload-pack.c;h=6f36f6255c3f4e3db4cdc7ca9b9dcca56846c72d;hb=v1.7.8-rc2-1-g5e9637c;hp=03adf28550a30ecd441b9586fc9dfa638c939ce3;hpb=58f75bcf323e86067147ac66bbb493e6a8c2631f;p=git.git diff --git a/upload-pack.c b/upload-pack.c index 03adf2855..6f36f6255 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -84,22 +84,11 @@ static void show_commit(struct commit *commit, void *data) commit->buffer = NULL; } -static void show_object(struct object *obj, const struct name_path *path, const char *component) +static void show_object(struct object *obj, + const struct name_path *path, const char *component, + void *cb_data) { - /* An object with name "foo\n0000000..." can be used to - * confuse downstream git-pack-objects very badly. - */ - const char *name = path_name(path, component); - const char *ep = strchr(name, '\n'); - if (ep) { - fprintf(pack_pipe, "%s %.*s\n", sha1_to_hex(obj->sha1), - (int) (ep - name), - name); - } - else - fprintf(pack_pipe, "%s %s\n", - sha1_to_hex(obj->sha1), name); - free((char *)name); + show_object_with_name(pack_pipe, obj, path, component); } static void show_edge(struct commit *commit) @@ -732,16 +721,17 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo " side-band-64k ofs-delta shallow no-progress" " include-tag multi_ack_detailed"; struct object *o = parse_object(sha1); + const char *refname_nons = strip_namespace(refname); if (!o) die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1)); if (capabilities) - packet_write(1, "%s %s%c%s%s\n", sha1_to_hex(sha1), refname, + packet_write(1, "%s %s%c%s%s\n", sha1_to_hex(sha1), refname_nons, 0, capabilities, stateless_rpc ? " no-done" : ""); else - packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname); + packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname_nons); capabilities = NULL; if (!(o->flags & OUR_REF)) { o->flags |= OUR_REF; @@ -750,7 +740,7 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo if (o->type == OBJ_TAG) { o = deref_tag(o, refname, 0); if (o) - packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname); + packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname_nons); } return 0; } @@ -771,12 +761,12 @@ static void upload_pack(void) { if (advertise_refs || !stateless_rpc) { reset_timeout(); - head_ref(send_ref, NULL); - for_each_ref(send_ref, NULL); + head_ref_namespaced(send_ref, NULL); + for_each_namespaced_ref(send_ref, NULL); packet_flush(1); } else { - head_ref(mark_our_ref, NULL); - for_each_ref(mark_our_ref, NULL); + head_ref_namespaced(mark_our_ref, NULL); + for_each_namespaced_ref(mark_our_ref, NULL); } if (advertise_refs) return; @@ -794,6 +784,8 @@ int main(int argc, char **argv) int i; int strict = 0; + git_setup_gettext(); + packet_trace_identity("upload-pack"); git_extract_argv0_path(argv[0]); read_replace_refs = 0;