rebase--interactive: avoid empty list in shell for-loop
[gitweb.git] / upload-pack.c
index 3a6352a1fccb516ce91f401f4a4a36ef5de358f1..dc802a07c2225463c2e4ee923b9cf144d57a00cc 100644 (file)
@@ -90,35 +90,32 @@ static void create_pack_file(void)
                "corruption on the remote side.";
        int buffered = -1;
        ssize_t sz;
-       const char *argv[13];
-       int i, arg = 0;
+       int i;
        FILE *pipe_fd;
 
        if (shallow_nr) {
-               argv[arg++] = "--shallow-file";
-               argv[arg++] = "";
+               argv_array_push(&pack_objects.args, "--shallow-file");
+               argv_array_push(&pack_objects.args, "");
        }
-       argv[arg++] = "pack-objects";
-       argv[arg++] = "--revs";
+       argv_array_push(&pack_objects.args, "pack-objects");
+       argv_array_push(&pack_objects.args, "--revs");
        if (use_thin_pack)
-               argv[arg++] = "--thin";
+               argv_array_push(&pack_objects.args, "--thin");
 
-       argv[arg++] = "--stdout";
+       argv_array_push(&pack_objects.args, "--stdout");
        if (shallow_nr)
-               argv[arg++] = "--shallow";
+               argv_array_push(&pack_objects.args, "--shallow");
        if (!no_progress)
-               argv[arg++] = "--progress";
+               argv_array_push(&pack_objects.args, "--progress");
        if (use_ofs_delta)
-               argv[arg++] = "--delta-base-offset";
+               argv_array_push(&pack_objects.args, "--delta-base-offset");
        if (use_include_tag)
-               argv[arg++] = "--include-tag";
-       argv[arg++] = NULL;
+               argv_array_push(&pack_objects.args, "--include-tag");
 
        pack_objects.in = -1;
        pack_objects.out = -1;
        pack_objects.err = -1;
        pack_objects.git_cmd = 1;
-       pack_objects.argv = argv;
 
        if (start_command(&pack_objects))
                die("git upload-pack: unable to fork git-pack-objects");
@@ -324,7 +321,7 @@ static int reachable(struct commit *want)
                        break;
                }
                if (!commit->object.parsed)
-                       parse_object(get_object_hash(commit->object));
+                       parse_object(commit->object.oid.hash);
                if (commit->object.flags & REACHABLE)
                        continue;
                commit->object.flags |= REACHABLE;
@@ -647,7 +644,7 @@ static void receive_needs(void)
                        if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
                                packet_write(1, "shallow %s",
                                                oid_to_hex(&object->oid));
-                               register_shallow(get_object_hash(*object));
+                               register_shallow(object->oid.hash);
                                shallow_nr++;
                        }
                        result = result->next;
@@ -661,7 +658,7 @@ static void receive_needs(void)
                                        oid_to_hex(&object->oid));
                                object->flags &= ~CLIENT_SHALLOW;
                                /* make sure the real parents are parsed */
-                               unregister_shallow(get_object_hash(*object));
+                               unregister_shallow(object->oid.hash);
                                object->parsed = 0;
                                parse_commit_or_die((struct commit *)object);
                                parents = ((struct commit *)object)->parents;
@@ -673,14 +670,14 @@ static void receive_needs(void)
                                add_object_array(object, NULL, &extra_edge_obj);
                        }
                        /* make sure commit traversal conforms to client */
-                       register_shallow(get_object_hash(*object));
+                       register_shallow(object->oid.hash);
                }
                packet_flush(1);
        } else
                if (shallows.nr > 0) {
                        int i;
                        for (i = 0; i < shallows.nr; i++)
-                               register_shallow(get_object_hash(*shallows.objects[i].item));
+                               register_shallow(shallows.objects[i].item->oid.hash);
                }
 
        shallow_nr += shallows.nr;