Code

documentation: fix alphabetic ordered list for git-rebase man page
[git.git] / upload-pack.c
index 8739bfacdfd4e01e16a614dd419388fa93a904b6..0d11e21a68b227101d6c7f6f4d7b305d08f77d95 100644 (file)
@@ -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)
@@ -596,6 +585,7 @@ static void receive_needs(void)
                write_str_in_full(debug_fd, "#S\n");
        for (;;) {
                struct object *o;
+               const char *features;
                unsigned char sha1_buf[20];
                len = packet_read_line(0, line, sizeof(line));
                reset_timeout();
@@ -627,23 +617,26 @@ static void receive_needs(void)
                    get_sha1_hex(line+5, sha1_buf))
                        die("git upload-pack: protocol error, "
                            "expected to get sha, not '%s'", line);
-               if (strstr(line+45, "multi_ack_detailed"))
+
+               features = line + 45;
+
+               if (parse_feature_request(features, "multi_ack_detailed"))
                        multi_ack = 2;
-               else if (strstr(line+45, "multi_ack"))
+               else if (parse_feature_request(features, "multi_ack"))
                        multi_ack = 1;
-               if (strstr(line+45, "no-done"))
+               if (parse_feature_request(features, "no-done"))
                        no_done = 1;
-               if (strstr(line+45, "thin-pack"))
+               if (parse_feature_request(features, "thin-pack"))
                        use_thin_pack = 1;
-               if (strstr(line+45, "ofs-delta"))
+               if (parse_feature_request(features, "ofs-delta"))
                        use_ofs_delta = 1;
-               if (strstr(line+45, "side-band-64k"))
+               if (parse_feature_request(features, "side-band-64k"))
                        use_sideband = LARGE_PACKET_MAX;
-               else if (strstr(line+45, "side-band"))
+               else if (parse_feature_request(features, "side-band"))
                        use_sideband = DEFAULT_PACKET_MAX;
-               if (strstr(line+45, "no-progress"))
+               if (parse_feature_request(features, "no-progress"))
                        no_progress = 1;
-               if (strstr(line+45, "include-tag"))
+               if (parse_feature_request(features, "include-tag"))
                        use_include_tag = 1;
 
                o = lookup_object(sha1_buf);
@@ -795,6 +788,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;