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

Function load_command_list

help.c:287–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void load_command_list(const char *prefix,
288 struct cmdnames *main_cmds,
289 struct cmdnames *other_cmds)
290{
291 const char *env_path = getenv("PATH");
292 const char *exec_path = git_exec_path();
293
294 load_builtin_commands(prefix, main_cmds);
295
296 if (exec_path) {
297 list_commands_in_dir(main_cmds, exec_path, prefix);
298 QSORT(main_cmds->names, main_cmds->cnt, cmdname_compare);
299 uniq(main_cmds);
300 }
301
302 if (env_path) {
303 char *paths, *path, *colon;
304 path = paths = xstrdup(env_path);
305 while (1) {
306 if ((colon = strchr(path, PATH_SEP)))
307 *colon = 0;
308 if (!exec_path || strcmp(path, exec_path))
309 list_commands_in_dir(other_cmds, path, prefix);
310
311 if (!colon)
312 break;
313 path = colon + 1;
314 }
315 free(paths);
316
317 QSORT(other_cmds->names, other_cmds->cnt, cmdname_compare);
318 uniq(other_cmds);
319 }
320 exclude_cmds(other_cmds, main_cmds);
321}
322
323static int get_colopts(const char *var, const char *value,
324 const struct config_context *ctx UNUSED, void *data)

Callers 6

list_all_main_cmdsFunction · 0.85
list_all_other_cmdsFunction · 0.85
help_unknown_cmdFunction · 0.85
is_git_commandFunction · 0.85
cmd_helpFunction · 0.85
get_strategyFunction · 0.85

Calls 6

git_exec_pathFunction · 0.85
list_commands_in_dirFunction · 0.85
uniqFunction · 0.85
xstrdupFunction · 0.85
exclude_cmdsFunction · 0.85
load_builtin_commandsFunction · 0.70

Tested by

no test coverage detected