summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f96400c)
raw | patch | inline | side by side (parent: f96400c)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 2 Sep 2011 23:52:08 +0000 (16:52 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 9 Sep 2011 22:19:05 +0000 (15:19 -0700) |
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c | patch | blob | history |
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index e1a687ad0761e46f6ec95659bb585b9014d4abf4..42f712318faf994efb0038c1036d934b5d279e9e 100644 (file)
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
#include "transport.h"
#include "string-list.h"
#include "sha1-array.h"
+#include "connected.h"
static const char receive_pack_usage[] = "git receive-pack <git-dir>";
string_list_clear(&ref_list, 0);
}
+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)
+ return -1; /* end of list */
+ *cmd_list = NULL; /* this returns only one */
+ hashcpy(sha1, cmd->new_sha1);
+ return 0;
+}
+
+static void set_connectivity_errors(struct command *commands)
+{
+ struct command *cmd;
+
+ for (cmd = commands; cmd; cmd = cmd->next) {
+ struct command *singleton = cmd;
+ if (!check_everything_connected(command_singleton_iterator,
+ 0, &singleton))
+ continue;
+ cmd->error_string = "missing necessary objects";
+ }
+}
+
+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;
+}
+
static void execute_commands(struct command *commands, const char *unpacker_error)
{
struct command *cmd;
@@ -557,6 +595,11 @@ static void execute_commands(struct command *commands, const char *unpacker_erro
return;
}
+ cmd = commands;
+ if (check_everything_connected(iterate_receive_command_list,
+ 0, &cmd))
+ set_connectivity_errors(commands);
+
if (run_receive_hook(commands, pre_receive_hook)) {
for (cmd = commands; cmd; cmd = cmd->next)
cmd->error_string = "pre-receive hook declined";