示例#1
0
文件: git.c 项目: Ferryworld/git
static int run_argv(int *argcp, const char ***argv)
{
	int done_alias = 0;

	while (1) {
		/*
		 * If we tried alias and futzed with our environment,
		 * it no longer is safe to invoke builtins directly in
		 * general.  We have to spawn them as dashed externals.
		 *
		 * NEEDSWORK: if we can figure out cases
		 * where it is safe to do, we can avoid spawning a new
		 * process.
		 */
		if (!done_alias)
			handle_builtin(*argcp, *argv);

		/* .. then try the external ones */
		execv_dashed_external(*argv);

		/* It could be an alias -- this works around the insanity
		 * of overriding "git log" with "git show" by having
		 * alias.log = show
		 */
		if (done_alias)
			break;
		if (!handle_alias(argcp, argv))
			break;
		done_alias = 1;
	}

	return done_alias;
}
示例#2
0
文件: git.c 项目: Grdflo/git-core
static int run_argv(int *argcp, const char ***argv)
{
	int done_alias = 0;

	while (1) {
		/* See if it's a builtin */
		handle_builtin(*argcp, *argv);

		/* .. then try the external ones */
		execv_dashed_external(*argv);

		/* It could be an alias -- this works around the insanity
		 * of overriding "git log" with "git show" by having
		 * alias.log = show
		 */
		if (done_alias)
			break;
		save_env();
		if (!handle_alias(argcp, argv))
			break;
		done_alias = 1;
	}

	return done_alias;
}
示例#3
0
文件: git.c 项目: benpeart/git
static int run_argv(int *argcp, const char ***argv)
{
	int done_alias = 0;

	while (1) {
		/*
		 * If we tried alias and futzed with our environment,
		 * it no longer is safe to invoke builtins directly in
		 * general.  We have to spawn them as dashed externals.
		 *
		 * NEEDSWORK: if we can figure out cases
		 * where it is safe to do, we can avoid spawning a new
		 * process.
		 */
		if (!done_alias)
			handle_builtin(*argcp, *argv);
		else if (get_builtin(**argv)) {
			struct argv_array args = ARGV_ARRAY_INIT;
			int i;

			if (get_super_prefix())
				die("%s doesn't support --super-prefix", **argv);

			commit_pager_choice();

			argv_array_push(&args, "git");
			for (i = 0; i < *argcp; i++)
				argv_array_push(&args, (*argv)[i]);

			trace_argv_printf(args.argv, "trace: exec:");

			/*
			 * if we fail because the command is not found, it is
			 * OK to return. Otherwise, we just pass along the status code.
			 */
			i = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE |
					      RUN_CLEAN_ON_EXIT);
			if (i >= 0 || errno != ENOENT)
				exit(i);
			die("could not execute builtin %s", **argv);
		}

		/* .. then try the external ones */
		execv_dashed_external(*argv);

		/* It could be an alias -- this works around the insanity
		 * of overriding "git log" with "git show" by having
		 * alias.log = show
		 */
		if (done_alias)
			break;
		if (!handle_alias(argcp, argv))
			break;
		done_alias = 1;
	}

	return done_alias;
}
static int run_argv(int *argcp, const char ***argv)
{
	int done_alias = 0;

	while (1) {
		
		handle_internal_command(*argcp, *argv);

		
		execv_dashed_external(*argv);

		if (done_alias || !handle_alias(argcp, argv))
			break;
		done_alias = 1;
	}

	return done_alias;
}
示例#5
0
void CheckExternalScripts::query_fallback(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response, const Plugin::QueryRequestMessage &) {
		//nscapi::functions::decoded_simple_command_data data = nscapi::functions::parse_simple_query_request(char_command, request);

		commands::optional_command_object command_def = commands_.find_object(request.command());

		std::list<std::string> args;
		for (int i=0;i<request.arguments_size();++i) {
			args.push_back(request.arguments(i));
		}
		if (command_def) {
			handle_command(*command_def, args, response);
			return;
		}
		alias::optional_command_object alias_def = aliases_.find_object(request.command());
		if (alias_def) {
			handle_alias(*alias_def, args, response);
			return;
		}
		NSC_LOG_ERROR_STD("No command or alias found matching: " + request.command());
		nscapi::protobuf::functions::set_response_bad(*response, "No command or alias found matching: " + request.command());
	}
示例#6
0
文件: perf.c 项目: swrite/ali_kernel
static int run_argv(int *argcp, const char ***argv)
{
	int done_alias = 0;

	while (1) {
		/* See if it's an internal command */
		handle_internal_command(*argcp, *argv);

		/* .. then try the external ones */
		execv_dashed_external(*argv);

		/* It could be an alias -- this works around the insanity
		 * of overriding "perf log" with "perf show" by having
		 * alias.log = show
		 */
		if (done_alias || !handle_alias(argcp, argv))
			break;
		done_alias = 1;
	}

	return done_alias;
}
示例#7
0
void CheckExternalScripts::query_fallback(const Plugin::QueryRequestMessage::Request &request, Plugin::QueryResponseMessage::Response *response, const Plugin::QueryRequestMessage &) {
	if (!provider_) {
		NSC_LOG_ERROR_STD("No provider found: " + request.command());
		nscapi::protobuf::functions::set_response_bad(*response, "No command or alias found matching: " + request.command());
		return;
	}
	commands::command_object_instance command_def = provider_->find_command(request.command());

	std::list<std::string> args;
	for (int i = 0; i < request.arguments_size(); ++i) {
		args.push_back(request.arguments(i));
	}
	if (command_def) {
		handle_command(*command_def, args, response);
		return;
	}
	alias::command_object_instance alias_def = aliases_.find_object(request.command());
	if (alias_def) {
		handle_alias(*alias_def, args, response);
		return;
	}
	NSC_LOG_ERROR_STD("No command or alias found matching: " + request.command());
	nscapi::protobuf::functions::set_response_bad(*response, "No command or alias found matching: " + request.command());
}