Exemple #1
0
static void execute_commands(struct command *commands, const char *unpacker_error)
{
	struct command *cmd;
	unsigned char sha1[20];

	if (unpacker_error) {
		for (cmd = commands; cmd; cmd = cmd->next)
			cmd->error_string = "n/a (unpacker error)";
		return;
	}

	cmd = commands;
	if (check_everything_connected(iterate_receive_command_list,
				       0, &cmd))
		set_connectivity_errors(commands);

	if (run_receive_hook(commands, pre_receive_hook, 0)) {
		for (cmd = commands; cmd; cmd = cmd->next)
			cmd->error_string = "pre-receive hook declined";
		return;
	}

	check_aliased_updates(commands);

	free(head_name_to_free);
	head_name = head_name_to_free = resolve_refdup("HEAD", sha1, 0, NULL);

	for (cmd = commands; cmd; cmd = cmd->next)
		if (!cmd->skip_update)
			cmd->error_string = update(cmd);
}
Exemple #2
0
static void execute_commands(struct command *commands,
			     const char *unpacker_error,
			     struct shallow_info *si,
			     const struct string_list *push_options)
{
	struct check_connected_options opt = CHECK_CONNECTED_INIT;
	struct command *cmd;
	unsigned char sha1[20];
	struct iterate_data data;
	struct async muxer;
	int err_fd = 0;

	if (unpacker_error) {
		for (cmd = commands; cmd; cmd = cmd->next)
			cmd->error_string = "unpacker error";
		return;
	}

	if (use_sideband) {
		memset(&muxer, 0, sizeof(muxer));
		muxer.proc = copy_to_sideband;
		muxer.in = -1;
		if (!start_async(&muxer))
			err_fd = muxer.in;
		/* ...else, continue without relaying sideband */
	}

	data.cmds = commands;
	data.si = si;
	opt.err_fd = err_fd;
	opt.progress = err_fd && !quiet;
	if (check_connected(iterate_receive_command_list, &data, &opt))
		set_connectivity_errors(commands, si);

	if (use_sideband)
		finish_async(&muxer);

	reject_updates_to_hidden(commands);

	if (run_receive_hook(commands, "pre-receive", 0, push_options)) {
		for (cmd = commands; cmd; cmd = cmd->next) {
			if (!cmd->error_string)
				cmd->error_string = "pre-receive hook declined";
		}
		return;
	}

	check_aliased_updates(commands);

	free(head_name_to_free);
	head_name = head_name_to_free = resolve_refdup("HEAD", 0, sha1, NULL);

	if (use_atomic)
		execute_commands_atomic(commands, si);
	else
		execute_commands_non_atomic(commands, si);

	if (shallow_update)
		warn_if_skipped_connectivity_check(commands, si);
}
Exemple #3
0
static void execute_commands(struct command *commands,
                             const char *unpacker_error,
                             struct shallow_info *si)
{
    int checked_connectivity;
    struct command *cmd;
    unsigned char sha1[20];
    struct iterate_data data;

    if (unpacker_error) {
        for (cmd = commands; cmd; cmd = cmd->next)
            cmd->error_string = "unpacker error";
        return;
    }

    data.cmds = commands;
    data.si = si;
    if (check_everything_connected(iterate_receive_command_list, 0, &data))
        set_connectivity_errors(commands, si);

    reject_updates_to_hidden(commands);

    if (run_receive_hook(commands, "pre-receive", 0)) {
        for (cmd = commands; cmd; cmd = cmd->next) {
            if (!cmd->error_string)
                cmd->error_string = "pre-receive hook declined";
        }
        return;
    }

    check_aliased_updates(commands);

    free(head_name_to_free);
    head_name = head_name_to_free = resolve_refdup("HEAD", 0, sha1, NULL);

    checked_connectivity = 1;
    for (cmd = commands; cmd; cmd = cmd->next) {
        if (cmd->error_string)
            continue;

        if (cmd->skip_update)
            continue;

        cmd->error_string = update(cmd, si);
        if (shallow_update && !cmd->error_string &&
                si->shallow_ref[cmd->index]) {
            error("BUG: connectivity check has not been run on ref %s",
                  cmd->ref_name);
            checked_connectivity = 0;
        }
    }

    if (shallow_update && !checked_connectivity)
        error("BUG: run 'git fsck' for safety.\n"
              "If there are errors, try to remove "
              "the reported refs above");
}
Exemple #4
0
static void execute_commands(struct command *commands,
			     const char *unpacker_error,
			     struct shallow_info *si)
{
	struct command *cmd;
	unsigned char sha1[20];
	struct iterate_data data;

	if (unpacker_error) {
		for (cmd = commands; cmd; cmd = cmd->next)
			cmd->error_string = "unpacker error";
		return;
	}

	data.cmds = commands;
	data.si = si;
	if (check_everything_connected(iterate_receive_command_list, 0, &data))
		set_connectivity_errors(commands, si);

	reject_updates_to_hidden(commands);

	if (run_receive_hook(commands, "pre-receive", 0)) {
		for (cmd = commands; cmd; cmd = cmd->next) {
			if (!cmd->error_string)
				cmd->error_string = "pre-receive hook declined";
		}
		return;
	}

	check_aliased_updates(commands);

	free(head_name_to_free);
	head_name = head_name_to_free = resolve_refdup("HEAD", 0, sha1, NULL);

	if (use_atomic)
		execute_commands_atomic(commands, si);
	else
		execute_commands_non_atomic(commands, si);

	if (shallow_update)
		warn_if_skipped_connectivity_check(commands, si);
}