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

Function run_argv

git.c:838–916  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

836}
837
838static int run_argv(struct strvec *args)
839{
840 int done_alias = 0;
841 struct string_list expanded_aliases = STRING_LIST_INIT_DUP;
842
843 while (1) {
844 /*
845 * Allow deprecated commands to be overridden by aliases. This
846 * creates a seamless path forward for people who want to keep
847 * using the name after it is gone, but want to skip the
848 * deprecation complaint in the meantime.
849 */
850 if (is_deprecated_command(args->v[0]) &&
851 handle_alias(args, &expanded_aliases)) {
852 done_alias = 1;
853 continue;
854 }
855 /*
856 * If we tried alias and futzed with our environment,
857 * it no longer is safe to invoke builtins directly in
858 * general. We have to spawn them as dashed externals.
859 *
860 * NEEDSWORK: if we can figure out cases
861 * where it is safe to do, we can avoid spawning a new
862 * process.
863 */
864 if (!done_alias)
865 handle_builtin(args);
866 else if (get_builtin(args->v[0])) {
867 struct child_process cmd = CHILD_PROCESS_INIT;
868 int err;
869
870 /*
871 * The current process is committed to launching a
872 * child process to run the command named in (**argv)
873 * and exiting. Log a generic string as the trace2
874 * command verb to indicate this. Note that the child
875 * process will log the actual verb when it runs.
876 */
877 trace2_cmd_name("_run_git_alias_");
878
879 commit_pager_choice();
880
881 strvec_push(&cmd.args, "git");
882 strvec_pushv(&cmd.args, args->v);
883
884 trace_argv_printf(cmd.args.v, "trace: exec:");
885
886 /*
887 * if we fail because the command is not found, it is
888 * OK to return. Otherwise, we just pass along the status code.
889 */
890 cmd.silent_exec_failure = 1;
891 cmd.clean_on_exit = 1;
892 cmd.wait_after_clean = 1;
893 cmd.trace2_child_class = "git_alias";
894 err = run_command(&cmd);
895 if (err >= 0 || errno != ENOENT)

Callers 1

cmd_mainFunction · 0.85

Calls 11

is_deprecated_commandFunction · 0.85
handle_aliasFunction · 0.85
handle_builtinFunction · 0.85
get_builtinFunction · 0.85
commit_pager_choiceFunction · 0.85
strvec_pushFunction · 0.85
strvec_pushvFunction · 0.85
run_commandFunction · 0.85
execv_dashed_externalFunction · 0.85
string_list_clearFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected