Skip to content

Commit a1a2614

Browse files
stefanbellergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b6a4788 commit a1a2614

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

builtin/receive-pack.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,18 @@ static void warn_if_skipped_connectivity_check(struct command *commands,
10641064
die("BUG: connectivity check skipped???");
10651065
}
10661066

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+
10671079
static void execute_commands(struct command *commands,
10681080
const char *unpacker_error,
10691081
struct shallow_info *si)
@@ -1098,12 +1110,7 @@ static void execute_commands(struct command *commands,
10981110
free(head_name_to_free);
10991111
head_name = head_name_to_free = resolve_refdup("HEAD", 0, sha1, NULL);
11001112

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);
11071114

11081115
if (shallow_update)
11091116
warn_if_skipped_connectivity_check(commands, si);

0 commit comments

Comments
 (0)