receive-pack.c: move iterating over all commands outside execute_commands

This commit allows us in a later patch to easily distinguish between the non atomic way to update the received refs and the atomic way which is introduced in a later patch. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Jan 7, 2015 at 19:23 UTC a1a261457c0577f5e0620fcc2b803999a6d5b8cf
1 file changed +13 -6
builtin/receive-pack.c
+13 -6
@@ -1064,6 +1064,18 @@ static void warn_if_skipped_connectivity_check(struct command *commands,
1064 die("BUG: connectivity check skipped???");
1065 }
1066
1067 +static void execute_commands_non_atomic(struct command *commands,
1068 + struct shallow_info *si)
1069 +{
1070 + struct command *cmd;
1071 + for (cmd = commands; cmd; cmd = cmd->next) {
1072 + if (!should_process_cmd(cmd))
1073 + continue;
1074 +
1075 + cmd->error_string = update(cmd, si);
1076 + }
1077 +}
1078 +
1079 static void execute_commands(struct command *commands,
1080 const char *unpacker_error,
1081 struct shallow_info *si)
@@ -1098,12 +1110,7 @@ static void execute_commands(struct command *commands,
1110 free(head_name_to_free);
1111 head_name = head_name_to_free = resolve_refdup("HEAD", 0, sha1, NULL);
1112
1101 - for (cmd = commands; cmd; cmd = cmd->next) {
1102 - if (!should_process_cmd(cmd))
1103 - continue;
1104 -
1105 - cmd->error_string = update(cmd, si);
1106 - }
1113 + execute_commands_non_atomic(commands, si);
1114
1115 if (shallow_update)
1116 warn_if_skipped_connectivity_check(commands, si);