mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
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>
This commit is contained in:
parent
d0482e88a7
commit
ef7e93d908
|
@ -623,8 +623,10 @@ static void check_aliased_updates(struct command *commands)
|
||||||
}
|
}
|
||||||
sort_string_list(&ref_list);
|
sort_string_list(&ref_list);
|
||||||
|
|
||||||
for (cmd = commands; cmd; cmd = cmd->next)
|
for (cmd = commands; cmd; cmd = cmd->next) {
|
||||||
check_aliased_update(cmd, &ref_list);
|
if (!cmd->error_string)
|
||||||
|
check_aliased_update(cmd, &ref_list);
|
||||||
|
}
|
||||||
|
|
||||||
string_list_clear(&ref_list, 0);
|
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);
|
set_connectivity_errors(commands);
|
||||||
|
|
||||||
if (run_receive_hook(commands, pre_receive_hook, 0)) {
|
if (run_receive_hook(commands, pre_receive_hook, 0)) {
|
||||||
for (cmd = commands; cmd; cmd = cmd->next)
|
for (cmd = commands; cmd; cmd = cmd->next) {
|
||||||
cmd->error_string = "pre-receive hook declined";
|
if (!cmd->error_string)
|
||||||
|
cmd->error_string = "pre-receive hook declined";
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,9 +701,15 @@ static void execute_commands(struct command *commands, const char *unpacker_erro
|
||||||
|
|
||||||
head_name = resolve_ref("HEAD", sha1, 0, NULL);
|
head_name = resolve_ref("HEAD", sha1, 0, NULL);
|
||||||
|
|
||||||
for (cmd = commands; cmd; cmd = cmd->next)
|
for (cmd = commands; cmd; cmd = cmd->next) {
|
||||||
if (!cmd->skip_update)
|
if (cmd->error_string)
|
||||||
cmd->error_string = update(cmd);
|
continue;
|
||||||
|
|
||||||
|
if (cmd->skip_update)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
cmd->error_string = update(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct command *read_head_info(void)
|
static struct command *read_head_info(void)
|
||||||
|
|
|
@ -58,6 +58,11 @@ test_expect_success 'fetch with transfer.fsckobjects' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat >exp <<EOF
|
||||||
|
To dst
|
||||||
|
! refs/heads/master:refs/heads/test [remote rejected] (missing necessary objects)
|
||||||
|
EOF
|
||||||
|
|
||||||
test_expect_success 'push without strict' '
|
test_expect_success 'push without strict' '
|
||||||
rm -rf dst &&
|
rm -rf dst &&
|
||||||
git init dst &&
|
git init dst &&
|
||||||
|
@ -66,7 +71,8 @@ test_expect_success 'push without strict' '
|
||||||
git config fetch.fsckobjects false &&
|
git config fetch.fsckobjects false &&
|
||||||
git config transfer.fsckobjects false
|
git config transfer.fsckobjects false
|
||||||
) &&
|
) &&
|
||||||
git push dst master:refs/heads/test
|
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
|
||||||
|
test_cmp exp act
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'push with !receive.fsckobjects' '
|
test_expect_success 'push with !receive.fsckobjects' '
|
||||||
|
@ -77,9 +83,15 @@ test_expect_success 'push with !receive.fsckobjects' '
|
||||||
git config receive.fsckobjects false &&
|
git config receive.fsckobjects false &&
|
||||||
git config transfer.fsckobjects true
|
git config transfer.fsckobjects true
|
||||||
) &&
|
) &&
|
||||||
git push dst master:refs/heads/test
|
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
|
||||||
|
test_cmp exp act
|
||||||
'
|
'
|
||||||
|
|
||||||
|
cat >exp <<EOF
|
||||||
|
To dst
|
||||||
|
! refs/heads/master:refs/heads/test [remote rejected] (n/a (unpacker error))
|
||||||
|
EOF
|
||||||
|
|
||||||
test_expect_success 'push with receive.fsckobjects' '
|
test_expect_success 'push with receive.fsckobjects' '
|
||||||
rm -rf dst &&
|
rm -rf dst &&
|
||||||
git init dst &&
|
git init dst &&
|
||||||
|
@ -88,7 +100,8 @@ test_expect_success 'push with receive.fsckobjects' '
|
||||||
git config receive.fsckobjects true &&
|
git config receive.fsckobjects true &&
|
||||||
git config transfer.fsckobjects false
|
git config transfer.fsckobjects false
|
||||||
) &&
|
) &&
|
||||||
test_must_fail git push dst master:refs/heads/test
|
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
|
||||||
|
test_cmp exp act
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'push with transfer.fsckobjects' '
|
test_expect_success 'push with transfer.fsckobjects' '
|
||||||
|
@ -98,7 +111,8 @@ test_expect_success 'push with transfer.fsckobjects' '
|
||||||
cd dst &&
|
cd dst &&
|
||||||
git config transfer.fsckobjects true
|
git config transfer.fsckobjects true
|
||||||
) &&
|
) &&
|
||||||
test_must_fail git push dst master:refs/heads/test
|
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
|
||||||
|
test_cmp exp act
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in a new issue