MCPcopy Index your code
hub / github.com/git/git / cmd_main

Function cmd_main

http-fetch.c:97–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97int cmd_main(int argc, const char **argv)
98{
99 int commits_on_stdin = 0;
100 int commits;
101 const char **write_ref = NULL;
102 char **commit_id;
103 int arg = 1;
104 int get_verbosely = 0;
105 int get_recover = 0;
106 int packfile = 0;
107 int nongit;
108 struct object_id packfile_hash;
109 struct strvec index_pack_args = STRVEC_INIT;
110 int ret;
111
112 setup_git_directory_gently(the_repository, &nongit);
113
114 while (arg < argc && argv[arg][0] == '-') {
115 const char *p;
116
117 if (argv[arg][1] == 't') {
118 } else if (argv[arg][1] == 'c') {
119 } else if (argv[arg][1] == 'a') {
120 } else if (argv[arg][1] == 'v') {
121 get_verbosely = 1;
122 } else if (argv[arg][1] == 'w') {
123 write_ref = &argv[arg + 1];
124 arg++;
125 } else if (argv[arg][1] == 'h') {
126 usage(http_fetch_usage);
127 } else if (!strcmp(argv[arg], "--recover")) {
128 get_recover = 1;
129 } else if (!strcmp(argv[arg], "--stdin")) {
130 commits_on_stdin = 1;
131 } else if (skip_prefix(argv[arg], "--packfile=", &p)) {
132 const char *end;
133
134 if (nongit)
135 die(_("not a git repository"));
136
137 packfile = 1;
138 if (parse_oid_hex_algop(p, &packfile_hash, &end,
139 the_repository->hash_algo) || *end)
140 die(_("argument to --packfile must be a valid hash (got '%s')"), p);
141 } else if (skip_prefix(argv[arg], "--index-pack-arg=", &p)) {
142 strvec_push(&index_pack_args, p);
143 }
144 arg++;
145 }
146 if (argc != arg + 2 - (commits_on_stdin || packfile))
147 usage(http_fetch_usage);
148
149 if (nongit)
150 die(_("not a git repository"));
151
152 trace2_cmd_name("http-fetch");
153
154 repo_config(the_repository, git_default_config, NULL);

Callers

nothing calls this directly

Calls 9

strvec_pushFunction · 0.85
fetch_single_packfileFunction · 0.85
walker_targets_stdinFunction · 0.85
fetch_using_walkerFunction · 0.85
strvec_clearFunction · 0.85
usageFunction · 0.70
dieFunction · 0.70
repo_configFunction · 0.70

Tested by

no test coverage detected