receive-pack: use bug() and BUG_if_bug()
Amend code added ina6a8431968
(receive-pack.c: shorten the execute_commands loop over all commands, 2015-01-07) and amended to hard die inb6a4788586
(receive-pack.c: die instead of error in case of possible future bug, 2015-01-07) to use the new bug() function instead. Let's also rename the warn_if_*() function that code is in to BUG_if_*(), its name became outdated inb6a4788586
. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
5b2f5d92ca
commit
07b1d8f184
@ -1810,21 +1810,17 @@ static int should_process_cmd(struct command *cmd)
|
|||||||
return !cmd->error_string && !cmd->skip_update;
|
return !cmd->error_string && !cmd->skip_update;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void warn_if_skipped_connectivity_check(struct command *commands,
|
static void BUG_if_skipped_connectivity_check(struct command *commands,
|
||||||
struct shallow_info *si)
|
struct shallow_info *si)
|
||||||
{
|
{
|
||||||
struct command *cmd;
|
struct command *cmd;
|
||||||
int checked_connectivity = 1;
|
|
||||||
|
|
||||||
for (cmd = commands; cmd; cmd = cmd->next) {
|
for (cmd = commands; cmd; cmd = cmd->next) {
|
||||||
if (should_process_cmd(cmd) && si->shallow_ref[cmd->index]) {
|
if (should_process_cmd(cmd) && si->shallow_ref[cmd->index])
|
||||||
error("BUG: connectivity check has not been run on ref %s",
|
bug("connectivity check has not been run on ref %s",
|
||||||
cmd->ref_name);
|
cmd->ref_name);
|
||||||
checked_connectivity = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!checked_connectivity)
|
BUG_if_bug("connectivity check skipped???");
|
||||||
BUG("connectivity check skipped???");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void execute_commands_non_atomic(struct command *commands,
|
static void execute_commands_non_atomic(struct command *commands,
|
||||||
@ -2005,7 +2001,7 @@ static void execute_commands(struct command *commands,
|
|||||||
execute_commands_non_atomic(commands, si);
|
execute_commands_non_atomic(commands, si);
|
||||||
|
|
||||||
if (shallow_update)
|
if (shallow_update)
|
||||||
warn_if_skipped_connectivity_check(commands, si);
|
BUG_if_skipped_connectivity_check(commands, si);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct command **queue_command(struct command **tail,
|
static struct command **queue_command(struct command **tail,
|
||||||
|
Reference in New Issue
Block a user