X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=http-fetch.c;h=94d47cbb287f7d3ea76b71f3ef39ddeea3b9202c;hb=c32c95916549331a581fadfa749c4322c14ccd78;hp=ffd0ad7e295d7341776bb7b6407602cdb2997ef3;hpb=c444c16589f95ac22d8e3ffe603cd7f0613512ce;p=git.git diff --git a/http-fetch.c b/http-fetch.c index ffd0ad7e2..94d47cbb2 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -1,5 +1,6 @@ #include "cache.h" #include "exec_cmd.h" +#include "http.h" #include "walker.h" static const char http_fetch_usage[] = "git http-fetch " @@ -7,14 +8,12 @@ static const char http_fetch_usage[] = "git http-fetch " int main(int argc, const char **argv) { - const char *prefix; struct walker *walker; int commits_on_stdin = 0; int commits; const char **write_ref = NULL; char **commit_id; - const char *url; - char *rewritten_url = NULL; + char *url = NULL; int arg = 1; int rc = 0; int get_tree = 0; @@ -56,20 +55,20 @@ int main(int argc, const char **argv) commit_id = (char **) &argv[arg++]; commits = 1; } - url = argv[arg]; - prefix = setup_git_directory(); + if (get_all == 0) + warning("http-fetch: use without -a is deprecated.\n" + "In a future release, -a will become the default."); - git_config(git_default_config, NULL); + if (argv[arg]) + str_end_url_with_slash(argv[arg], &url); - if (url && url[strlen(url)-1] != '/') { - rewritten_url = xmalloc(strlen(url)+2); - strcpy(rewritten_url, url); - strcat(rewritten_url, "/"); - url = rewritten_url; - } + setup_git_directory(); + + git_config(git_default_config, NULL); - walker = get_http_walker(url, NULL); + http_init(NULL, url, 0); + walker = get_http_walker(url); walker->get_tree = get_tree; walker->get_history = get_history; walker->get_all = get_all; @@ -89,8 +88,9 @@ int main(int argc, const char **argv) } walker_free(walker); + http_cleanup(); - free(rewritten_url); + free(url); return rc; }