6 static const char http_fetch_usage[] = "git http-fetch "
7 "[-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url";
9 int cmd_main(int argc, const char **argv)
11 struct walker *walker;
12 int commits_on_stdin = 0;
14 const char **write_ref = NULL;
22 int get_verbosely = 0;
25 while (arg < argc && argv[arg][0] == '-') {
26 if (argv[arg][1] == 't') {
28 } else if (argv[arg][1] == 'c') {
30 } else if (argv[arg][1] == 'a') {
34 } else if (argv[arg][1] == 'v') {
36 } else if (argv[arg][1] == 'w') {
37 write_ref = &argv[arg + 1];
39 } else if (argv[arg][1] == 'h') {
40 usage(http_fetch_usage);
41 } else if (!strcmp(argv[arg], "--recover")) {
43 } else if (!strcmp(argv[arg], "--stdin")) {
48 if (argc != arg + 2 - commits_on_stdin)
49 usage(http_fetch_usage);
50 if (commits_on_stdin) {
51 commits = walker_targets_stdin(&commit_id, &write_ref);
53 commit_id = (char **) &argv[arg++];
58 warning("http-fetch: use without -a is deprecated.\n"
59 "In a future release, -a will become the default.");
62 str_end_url_with_slash(argv[arg], &url);
64 setup_git_directory();
66 git_config(git_default_config, NULL);
68 http_init(NULL, url, 0);
69 walker = get_http_walker(url);
70 walker->get_tree = get_tree;
71 walker->get_history = get_history;
72 walker->get_all = get_all;
73 walker->get_verbosely = get_verbosely;
74 walker->get_recover = get_recover;
76 rc = walker_fetch(walker, commits, commit_id, write_ref, url);
79 walker_targets_free(commits, commit_id, write_ref);
81 if (walker->corrupt_object_found) {
83 "Some loose object were found to be corrupt, but they might be just\n"
84 "a false '404 Not Found' error message sent with incorrect HTTP\n"
85 "status code. Suggest running 'git fsck'.\n");