HTTP cleanup
[git.git] / http-push.c
index 114d01b..40524a8 100644 (file)
@@ -788,6 +788,7 @@ static void finish_request(struct transfer_request *request)
        }
 }
 
+#ifdef USE_CURL_MULTI
 void fill_active_slots(void)
 {
        struct transfer_request *request = request_queue_head;
@@ -821,6 +822,7 @@ void fill_active_slots(void)
                slot = slot->next;
        }
 }
+#endif
 
 static void get_remote_object_list(unsigned char parent);
 
@@ -851,8 +853,10 @@ static void add_fetch_request(struct object *obj)
        request->next = request_queue_head;
        request_queue_head = request;
 
+#ifdef USE_CURL_MULTI
        fill_active_slots();
        step_active_slots();
+#endif
 }
 
 static int add_send_request(struct object *obj, struct remote_lock *lock)
@@ -889,8 +893,10 @@ static int add_send_request(struct object *obj, struct remote_lock *lock)
        request->next = request_queue_head;
        request_queue_head = request;
 
+#ifdef USE_CURL_MULTI
        fill_active_slots();
        step_active_slots();
+#endif
 
        return 1;
 }
@@ -1704,6 +1710,7 @@ static struct object_list **process_blob(struct blob *blob,
                return p;
 
        obj->flags |= SEEN;
+       name = strdup(name);
        return add_object(obj, p, path, name);
 }
 
@@ -1713,7 +1720,8 @@ static struct object_list **process_tree(struct tree *tree,
                                         const char *name)
 {
        struct object *obj = &tree->object;
-       struct tree_entry_list *entry;
+       struct tree_desc desc;
+       struct name_entry entry;
        struct name_path me;
 
        obj->flags |= LOCAL;
@@ -1724,21 +1732,23 @@ static struct object_list **process_tree(struct tree *tree,
                die("bad tree object %s", sha1_to_hex(obj->sha1));
 
        obj->flags |= SEEN;
+       name = strdup(name);
        p = add_object(obj, p, NULL, name);
        me.up = path;
        me.elem = name;
        me.elem_len = strlen(name);
-       entry = tree->entries;
-       tree->entries = NULL;
-       while (entry) {
-               struct tree_entry_list *next = entry->next;
-               if (entry->directory)
-                       p = process_tree(entry->item.tree, p, &me, entry->name);
+
+       desc.buf = tree->buffer;
+       desc.size = tree->size;
+
+       while (tree_entry(&desc, &entry)) {
+               if (S_ISDIR(entry.mode))
+                       p = process_tree(lookup_tree(entry.sha1), p, &me, name);
                else
-                       p = process_blob(entry->item.blob, p, &me, entry->name);
-               free(entry);
-               entry = next;
+                       p = process_blob(lookup_blob(entry.sha1), p, &me, name);
        }
+       free(tree->buffer);
+       tree->buffer = NULL;
        return p;
 }
 
@@ -2498,6 +2508,7 @@ int main(int argc, char **argv)
                        commit_argv[3] = old_sha1_hex;
                        commit_argc++;
                }
+               init_revisions(&revs);
                setup_revisions(commit_argc, commit_argv, &revs, NULL);
                free(new_sha1_hex);
                if (old_sha1_hex) {
@@ -2518,7 +2529,9 @@ int main(int argc, char **argv)
                if (objects_to_send)
                        fprintf(stderr, "    sending %d objects\n",
                                objects_to_send);
+#ifdef USE_CURL_MULTI
                fill_active_slots();
+#endif
                finish_all_active_slots();
 
                /* Update the remote branch if all went well */