summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 09ae9ac)
raw | patch | inline | side by side (parent: 09ae9ac)
author | Tay Ray Chuan <rctay89@gmail.com> | |
Tue, 2 Mar 2010 10:49:29 +0000 (18:49 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 2 Mar 2010 19:10:36 +0000 (11:10 -0800) |
Previously, all our http operations were done with http-walker. With the
new remote-curl helper, we find ourselves using http methods outside of
http-walker - for example, fetching info/refs.
Accomodate this by separating http_init() and http_cleanup() invocations
from http-walker.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
new remote-curl helper, we find ourselves using http methods outside of
http-walker - for example, fetching info/refs.
Accomodate this by separating http_init() and http_cleanup() invocations
from http-walker.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-fetch.c | patch | blob | history | |
http-walker.c | patch | blob | history | |
remote-curl.c | patch | blob | history | |
walker.h | patch | blob | history |
diff --git a/http-fetch.c b/http-fetch.c
index ffd0ad7e295d7341776bb7b6407602cdb2997ef3..762c750d7af3651287c147034d3dead469453e7c 100644 (file)
--- a/http-fetch.c
+++ b/http-fetch.c
#include "cache.h"
#include "exec_cmd.h"
+#include "http.h"
#include "walker.h"
static const char http_fetch_usage[] = "git http-fetch "
url = rewritten_url;
}
- walker = get_http_walker(url, NULL);
+ http_init(NULL);
+ walker = get_http_walker(url);
walker->get_tree = get_tree;
walker->get_history = get_history;
walker->get_all = get_all;
}
walker_free(walker);
+ http_cleanup();
free(rewritten_url);
diff --git a/http-walker.c b/http-walker.c
index 508e35517c55b8b9f894c46a25e831f1ed3652b9..ef99ae647ae02995495c71455eef785bdeca1789 100644 (file)
--- a/http-walker.c
+++ b/http-walker.c
free(data);
walker->data = NULL;
}
-
- http_cleanup();
}
-struct walker *get_http_walker(const char *url, struct remote *remote)
+struct walker *get_http_walker(const char *url)
{
char *s;
struct walker_data *data = xmalloc(sizeof(struct walker_data));
struct walker *walker = xmalloc(sizeof(struct walker));
- http_init(remote);
-
data->alt = xmalloc(sizeof(*data->alt));
data->alt->base = xmalloc(strlen(url) + 1);
strcpy(data->alt->base, url);
diff --git a/remote-curl.c b/remote-curl.c
index a904164e425097380781c1ecd9bb13f4feec0de6..e8485d1552e20f65eb4f4ebfb95d7365274d1105 100644 (file)
--- a/remote-curl.c
+++ b/remote-curl.c
static void init_walker(void)
{
if (!walker)
- walker = get_http_walker(url, remote);
+ walker = get_http_walker(url);
}
static int set_option(const char *name, const char *value)
url = remote->url[0];
}
+ http_init(remote);
+
do {
if (strbuf_getline(&buf, stdin, '\n') == EOF)
break;
}
strbuf_reset(&buf);
} while (1);
+
+ http_cleanup();
+
return 0;
}
diff --git a/walker.h b/walker.h
index 8a149e11084eeec4501b5b2c5d22e5266f4852e7..95e576548474e942addcf1978f215720dd2f6e96 100644 (file)
--- a/walker.h
+++ b/walker.h
void walker_free(struct walker *walker);
-struct walker *get_http_walker(const char *url, struct remote *remote);
+struct walker *get_http_walker(const char *url);
#endif /* WALKER_H */