diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-07-06 15:38:28 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-07-06 15:38:28 -0700 |
commit | 25d33546d474c7c28b72013c262fc23337cb3b21 (patch) | |
tree | 7551eb457a33329be6b3bb0fc11f76118a6e2c42 /http-walker.c | |
parent | Merge commit 'v1.7.0' into jc/checkout-reflog-fix (diff) | |
parent | Git 1.7.6 (diff) | |
download | tgif-25d33546d474c7c28b72013c262fc23337cb3b21.tar.xz |
Merge commit 'v1.7.6' into jc/checkout-reflog-fix
* commit 'v1.7.6': (3211 commits)
Git 1.7.6
completion: replace core.abbrevguard to core.abbrev
Git 1.7.6-rc3
Documentation: git diff --check respects core.whitespace
gitweb: 'pickaxe' and 'grep' features requires 'search' to be enabled
t7810: avoid unportable use of "echo"
plug a few coverity-spotted leaks
builtin/gc.c: add missing newline in message
tests: link shell libraries into valgrind directory
t/Makefile: pass test opts to valgrind target properly
sh-i18n--envsubst.c: do not #include getopt.h
Fix typo: existant->existent
Git 1.7.6-rc2
gitweb: do not misparse nonnumeric content tag files that contain a digit
Git 1.7.6-rc1
fetch: do not leak a refspec
t3703: skip more tests using colons in file names on Windows
gitweb: Fix usability of $prevent_xss
gitweb: Move "Requirements" up in gitweb/INSTALL
gitweb: Describe CSSMIN and JSMIN in gitweb/INSTALL
...
Diffstat (limited to 'http-walker.c')
-rw-r--r-- | http-walker.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/http-walker.c b/http-walker.c index 700bc13112..51a906e9e3 100644 --- a/http-walker.c +++ b/http-walker.c @@ -3,8 +3,7 @@ #include "walker.h" #include "http.h" -struct alt_base -{ +struct alt_base { char *base; int got_indices; struct packed_git *packs; @@ -15,11 +14,10 @@ enum object_request_state { WAITING, ABORTED, ACTIVE, - COMPLETE, + COMPLETE }; -struct object_request -{ +struct object_request { struct walker *walker; unsigned char sha1[20]; struct alt_base *repo; @@ -187,7 +185,7 @@ static void process_alternates_response(void *callback_data) struct active_request_slot *slot = alt_req->slot; struct alt_base *tail = cdata->alt; const char *base = alt_req->base; - static const char null_byte = '\0'; + const char null_byte = '\0'; char *data; int i = 0; @@ -220,7 +218,7 @@ static void process_alternates_response(void *callback_data) } } - fwrite_buffer(&null_byte, 1, 1, alt_req->buffer); + fwrite_buffer((char *)&null_byte, 1, 1, alt_req->buffer); alt_req->buffer->len--; data = alt_req->buffer->buf; @@ -510,7 +508,7 @@ static int fetch_object(struct walker *walker, struct alt_base *repo, unsigned c ret = error("File %s has bad hash", hex); } else if (req->rename < 0) { ret = error("unable to write sha1 filename %s", - req->filename); + sha1_file_name(req->sha1)); } release_http_object_request(req); @@ -543,17 +541,30 @@ static int fetch_ref(struct walker *walker, struct ref *ref) static void cleanup(struct walker *walker) { - http_cleanup(); + struct walker_data *data = walker->data; + struct alt_base *alt, *alt_next; + + if (data) { + alt = data->alt; + while (alt) { + alt_next = alt->next; + + free(alt->base); + free(alt); + + alt = alt_next; + } + free(data); + walker->data = NULL; + } } -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); |