Skip to content

Commit 07b1d8f

Browse files
avargitster
authored andcommitted
receive-pack: use bug() and BUG_if_bug()
Amend code added in a6a8431 (receive-pack.c: shorten the execute_commands loop over all commands, 2015-01-07) and amended to hard die in b6a4788 (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 in b6a4788. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5b2f5d9 commit 07b1d8f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

builtin/receive-pack.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,21 +1810,17 @@ static int should_process_cmd(struct command *cmd)
18101810
return !cmd->error_string && !cmd->skip_update;
18111811
}
18121812

1813-
static void warn_if_skipped_connectivity_check(struct command *commands,
1813+
static void BUG_if_skipped_connectivity_check(struct command *commands,
18141814
struct shallow_info *si)
18151815
{
18161816
struct command *cmd;
1817-
int checked_connectivity = 1;
18181817

18191818
for (cmd = commands; cmd; cmd = cmd->next) {
1820-
if (should_process_cmd(cmd) && si->shallow_ref[cmd->index]) {
1821-
error("BUG: connectivity check has not been run on ref %s",
1822-
cmd->ref_name);
1823-
checked_connectivity = 0;
1824-
}
1819+
if (should_process_cmd(cmd) && si->shallow_ref[cmd->index])
1820+
bug("connectivity check has not been run on ref %s",
1821+
cmd->ref_name);
18251822
}
1826-
if (!checked_connectivity)
1827-
BUG("connectivity check skipped???");
1823+
BUG_if_bug("connectivity check skipped???");
18281824
}
18291825

18301826
static void execute_commands_non_atomic(struct command *commands,
@@ -2005,7 +2001,7 @@ static void execute_commands(struct command *commands,
20052001
execute_commands_non_atomic(commands, si);
20062002

20072003
if (shallow_update)
2008-
warn_if_skipped_connectivity_check(commands, si);
2004+
BUG_if_skipped_connectivity_check(commands, si);
20092005
}
20102006

20112007
static struct command **queue_command(struct command **tail,

0 commit comments

Comments
 (0)