Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2021-09-24 21:37:11 +0300
committerJunio C Hamano <gitster@pobox.com>2021-09-27 22:36:45 +0300
commit5b062e1f79b5121296678d91b2bbd032ca86a866 (patch)
treeb8e06a524406c5d3fe882abfdb68b95764a21b7a /t/t5312-prune-corruption.sh
parent078eecbcbe04bf77e8b9afee01a58c905c3b3c50 (diff)
t5312: be more assertive about command failure
When repacking or pruning in a corrupted repository, our tests in t5312 argue that it is OK to complete the operation or bail, as long as we don't actually delete the objects pointed to by the corruption. This isn't a wrong line of reasoning, but the tests are a bit permissive by using test_might_fail. The fact is that we _do_ bail currently, and if we ever stopped doing so, that would be worthy of a human investigating. So let's switch these to test_must_fail. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5312-prune-corruption.sh')
-rwxr-xr-xt/t5312-prune-corruption.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh
index c7010fb754..1522a4ba8e 100755
--- a/t/t5312-prune-corruption.sh
+++ b/t/t5312-prune-corruption.sh
@@ -7,6 +7,9 @@ if we see, for example, a ref with a bogus name, it is OK either to
bail out or to proceed using it as a reachable tip, but it is _not_
OK to proceed as if it did not exist. Otherwise we might silently
delete objects that cannot be recovered.
+
+Note that we do assert command failure in these cases, because that is
+what currently happens. If that changes, these tests should be revisited.
'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
@@ -35,7 +38,7 @@ test_expect_success 'create history reachable only from a bogus-named ref' '
test_expect_success 'pruning does not drop bogus object' '
test_when_finished "git hash-object -w -t commit saved" &&
create_bogus_ref &&
- test_might_fail git prune --expire=now &&
+ test_must_fail git prune --expire=now &&
git cat-file -e $bogus
'
@@ -53,9 +56,9 @@ test_expect_success 'non-destructive repack ignores bogus name' '
test_expect_success 'destructive repack keeps packed object' '
create_bogus_ref &&
- test_might_fail git repack -Ad --unpack-unreachable=now &&
+ test_must_fail git repack -Ad --unpack-unreachable=now &&
git cat-file -e $bogus &&
- test_might_fail git repack -ad &&
+ test_must_fail git repack -ad &&
git cat-file -e $bogus
'
@@ -83,7 +86,7 @@ test_expect_success 'create history with missing tip commit' '
test_expect_success 'pruning with a corrupted tip does not drop history' '
test_when_finished "git hash-object -w -t commit saved" &&
- test_might_fail git prune --expire=now &&
+ test_must_fail git prune --expire=now &&
git cat-file -e $recoverable
'