X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Freceive-pack.c;h=7ec68a1e8089f74ce7c70fecd86d5c18264ce4bc;hb=1e7ba0f9caf1993491aa4c5cbd796cd31cb0f4af;hp=261b610d24017557c137d83a9c005b662e795b6a;hpb=662384c4996c7bc46322dc6d4f5afafa6e069d40;p=git.git diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 261b610d2..7ec68a1e8 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -634,7 +634,7 @@ static int command_singleton_iterator(void *cb_data, unsigned char sha1[20]) struct command **cmd_list = cb_data; struct command *cmd = *cmd_list; - if (!cmd) + if (!cmd || is_null_sha1(cmd->new_sha1)) return -1; /* end of list */ *cmd_list = NULL; /* this returns only one */ hashcpy(sha1, cmd->new_sha1); @@ -659,11 +659,16 @@ static int iterate_receive_command_list(void *cb_data, unsigned char sha1[20]) struct command **cmd_list = cb_data; struct command *cmd = *cmd_list; - if (!cmd) - return -1; /* end of list */ - *cmd_list = cmd->next; - hashcpy(sha1, cmd->new_sha1); - return 0; + while (cmd) { + if (!is_null_sha1(cmd->new_sha1)) { + hashcpy(sha1, cmd->new_sha1); + *cmd_list = cmd->next; + return 0; + } + cmd = cmd->next; + } + *cmd_list = NULL; + return -1; /* end of list */ } static void execute_commands(struct command *commands, const char *unpacker_error)