5 int main(int argc
, const char **argv
)
9 int commits_on_stdin
= 0;
11 const char **write_ref
= NULL
;
14 char *rewritten_url
= NULL
;
20 int get_verbosely
= 0;
23 git_extract_argv0_path(argv
[0]);
24 prefix
= setup_git_directory();
25 git_config(git_default_config
, NULL
);
27 while (arg
< argc
&& argv
[arg
][0] == '-') {
28 if (argv
[arg
][1] == 't') {
30 } else if (argv
[arg
][1] == 'c') {
32 } else if (argv
[arg
][1] == 'a') {
36 } else if (argv
[arg
][1] == 'v') {
38 } else if (argv
[arg
][1] == 'w') {
39 write_ref
= &argv
[arg
+ 1];
41 } else if (!strcmp(argv
[arg
], "--recover")) {
43 } else if (!strcmp(argv
[arg
], "--stdin")) {
48 if (argc
< arg
+ 2 - commits_on_stdin
) {
49 usage("git http-fetch [-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url");
52 if (commits_on_stdin
) {
53 commits
= walker_targets_stdin(&commit_id
, &write_ref
);
55 commit_id
= (char **) &argv
[arg
++];
59 if (url
&& url
[strlen(url
)-1] != '/') {
60 rewritten_url
= xmalloc(strlen(url
)+2);
61 strcpy(rewritten_url
, url
);
62 strcat(rewritten_url
, "/");
66 walker
= get_http_walker(url
, NULL
);
67 walker
->get_tree
= get_tree
;
68 walker
->get_history
= get_history
;
69 walker
->get_all
= get_all
;
70 walker
->get_verbosely
= get_verbosely
;
71 walker
->get_recover
= get_recover
;
73 rc
= walker_fetch(walker
, commits
, commit_id
, write_ref
, url
);
76 walker_targets_free(commits
, commit_id
, write_ref
);
78 if (walker
->corrupt_object_found
) {
80 "Some loose object were found to be corrupt, but they might be just\n"
81 "a false '404 Not Found' error message sent with incorrect HTTP\n"
82 "status code. Suggest running 'git fsck'.\n");