summaryrefslogtreecommitdiff
path: root/builtin/receive-pack.c
diff options
context:
space:
mode:
authorClemens Buchacher <drizzd@aon.at>2012-02-13 20:17:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-02-13 21:29:08 (GMT)
commitef7e93d90866e91bba5ff7f274c49dc44427a8ff (patch)
tree5288d54312763c623686edebd736d4da7a7f7825 /builtin/receive-pack.c
parentd0482e88a735787f7bb33ef4783be0e7f6a70946 (diff)
downloadgit-ef7e93d90866e91bba5ff7f274c49dc44427a8ff.zip
git-ef7e93d90866e91bba5ff7f274c49dc44427a8ff.tar.gz
git-ef7e93d90866e91bba5ff7f274c49dc44427a8ff.tar.bz2
do not override receive-pack errors
Receive runs rev-list --verify-objects in order to detect missing objects. However, such errors are ignored and overridden later. Instead, consequently ignore all update commands for which an error has already been detected. Some tests in t5504 are obsoleted by this change, because invalid objects are detected even if fsck is not enabled. Instead, they now test for different error messages depending on whether or not fsck is turned on. A better fix would be to force a corruption that will be detected by fsck but not by rev-list. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 7ec68a1..798dca9 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -623,8 +623,10 @@ static void check_aliased_updates(struct command *commands)
}
sort_string_list(&ref_list);
- for (cmd = commands; cmd; cmd = cmd->next)
- check_aliased_update(cmd, &ref_list);
+ for (cmd = commands; cmd; cmd = cmd->next) {
+ if (!cmd->error_string)
+ check_aliased_update(cmd, &ref_list);
+ }
string_list_clear(&ref_list, 0);
}
@@ -688,8 +690,10 @@ static void execute_commands(struct command *commands, const char *unpacker_erro
set_connectivity_errors(commands);
if (run_receive_hook(commands, pre_receive_hook, 0)) {
- for (cmd = commands; cmd; cmd = cmd->next)
- cmd->error_string = "pre-receive hook declined";
+ for (cmd = commands; cmd; cmd = cmd->next) {
+ if (!cmd->error_string)
+ cmd->error_string = "pre-receive hook declined";
+ }
return;
}
@@ -697,9 +701,15 @@ static void execute_commands(struct command *commands, const char *unpacker_erro
head_name = resolve_ref("HEAD", sha1, 0, NULL);
- for (cmd = commands; cmd; cmd = cmd->next)
- if (!cmd->skip_update)
- cmd->error_string = update(cmd);
+ for (cmd = commands; cmd; cmd = cmd->next) {
+ if (cmd->error_string)
+ continue;
+
+ if (cmd->skip_update)
+ continue;
+
+ cmd->error_string = update(cmd);
+ }
}
static struct command *read_head_info(void)