4 int main(int argc
, const char **argv
)
8 int commits_on_stdin
= 0;
10 const char **write_ref
= NULL
;
13 char *rewritten_url
= NULL
;
19 int get_verbosely
= 0;
22 prefix
= setup_git_directory();
24 git_config(git_default_config
, NULL
);
26 while (arg
< argc
&& argv
[arg
][0] == '-') {
27 if (argv
[arg
][1] == 't') {
29 } else if (argv
[arg
][1] == 'c') {
31 } else if (argv
[arg
][1] == 'a') {
35 } else if (argv
[arg
][1] == 'v') {
37 } else if (argv
[arg
][1] == 'w') {
38 write_ref
= &argv
[arg
+ 1];
40 } else if (!strcmp(argv
[arg
], "--recover")) {
42 } else if (!strcmp(argv
[arg
], "--stdin")) {
47 if (argc
< arg
+ 2 - commits_on_stdin
) {
48 usage("git http-fetch [-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url");
51 if (commits_on_stdin
) {
52 commits
= walker_targets_stdin(&commit_id
, &write_ref
);
54 commit_id
= (char **) &argv
[arg
++];
58 if (url
&& url
[strlen(url
)-1] != '/') {
59 rewritten_url
= xmalloc(strlen(url
)+2);
60 strcpy(rewritten_url
, url
);
61 strcat(rewritten_url
, "/");
65 walker
= get_http_walker(url
, NULL
);
66 walker
->get_tree
= get_tree
;
67 walker
->get_history
= get_history
;
68 walker
->get_all
= get_all
;
69 walker
->get_verbosely
= get_verbosely
;
70 walker
->get_recover
= get_recover
;
72 rc
= walker_fetch(walker
, commits
, commit_id
, write_ref
, url
);
75 walker_targets_free(commits
, commit_id
, write_ref
);
77 if (walker
->corrupt_object_found
) {
79 "Some loose object were found to be corrupt, but they might be just\n"
80 "a false '404 Not Found' error message sent with incorrect HTTP\n"
81 "status code. Suggest running 'git fsck'.\n");