X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=http-push.c;h=40524a8593a96e83fa4e32c429034490112d1033;hb=b3ca4e4ebba6915ea534c4b82cfc5d6f10b4c283;hp=57cefdea530171c71c72229a85aa0212dedb2c5a;hpb=910a5916b40575501b452a61e6447f96e77ec95e;p=git.git diff --git a/http-push.c b/http-push.c index 57cefdea..40524a85 100644 --- a/http-push.c +++ b/http-push.c @@ -6,6 +6,7 @@ #include "blob.h" #include "http.h" #include "refs.h" +#include "diff.h" #include "revision.h" #include "exec_cmd.h" @@ -59,12 +60,12 @@ enum XML_Status { #define LOCK_TIME 600 #define LOCK_REFRESH 30 -/* bits #0-6 in revision.h */ +/* bits #0-15 in revision.h */ -#define LOCAL (1u << 7) -#define REMOTE (1u << 8) -#define FETCHING (1u << 9) -#define PUSHING (1u << 10) +#define LOCAL (1u<<16) +#define REMOTE (1u<<17) +#define FETCHING (1u<<18) +#define PUSHING (1u<<19) /* We allow "recursive" symbolic refs. Only within reason, though */ #define MAXDEPTH 5 @@ -787,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; @@ -820,6 +822,7 @@ void fill_active_slots(void) slot = slot->next; } } +#endif static void get_remote_object_list(unsigned char parent); @@ -850,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) @@ -888,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; } @@ -1211,7 +1218,7 @@ static void xml_start_tag(void *userData, const char *name, const char **atts) { struct xml_ctx *ctx = (struct xml_ctx *)userData; - const char *c = index(name, ':'); + const char *c = strchr(name, ':'); int new_len; if (c == NULL) @@ -1240,7 +1247,7 @@ static void xml_end_tag(void *userData, const char *name) { struct xml_ctx *ctx = (struct xml_ctx *)userData; - const char *c = index(name, ':'); + const char *c = strchr(name, ':'); char *ep; ctx->userFunc(ctx, 1); @@ -1703,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); } @@ -1712,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; @@ -1723,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; } @@ -2350,7 +2361,7 @@ int main(int argc, char **argv) char *path = strstr(arg, "//"); remote->url = arg; if (path) { - path = index(path+2, '/'); + path = strchr(path+2, '/'); if (path) remote->path_len = strlen(path); } @@ -2497,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) { @@ -2517,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 */