From 3fb0459bc89bebb07e0603ce3ce92dbbc8a39ea4 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 11 Apr 2012 13:24:01 +0200 Subject: tests: modernise style: more uses of test_line_count Prefer: test_line_count COUNT FILE over: test $(wc -l COUNT (or similar usages) in several tests. Signed-off-by: Stefano Lattarini Signed-off-by: Junio C Hamano --- t/t5710-info-alternate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t5710-info-alternate.sh') diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh index ef7127c1b3..aa045295de 100755 --- a/t/t5710-info-alternate.sh +++ b/t/t5710-info-alternate.sh @@ -18,7 +18,7 @@ reachable_via() { test_valid_repo() { git fsck --full > fsck.log && - test `wc -l < fsck.log` = 0 + test_line_count = 0 fsck.log } base_dir=`pwd` -- cgit v1.2.1 From 0aac7bb287645dd72ad8ad6b805128b8ff7f111f Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 25 Mar 2013 16:23:59 -0400 Subject: clone: die on errors from unpack_trees When clone is populating the working tree, it ignores the return status from unpack_trees; this means we may report a successful clone, even when the checkout fails. When checkout fails, we may want to leave the $GIT_DIR in place, as it might be possible to recover the data through further use of "git checkout" (e.g., if the checkout failed due to a transient error, disk full, etc). However, we already die on a number of other checkout-related errors, so this patch follows that pattern. In addition to marking a now-passing test, we need to adjust t5710, which blindly assumed it could make bogus clones of very deep alternates hierarchies. By using "--bare", we can avoid it actually touching any objects. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t5710-info-alternate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t5710-info-alternate.sh') diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh index aa045295de..5a6e49d18d 100755 --- a/t/t5710-info-alternate.sh +++ b/t/t5710-info-alternate.sh @@ -58,7 +58,7 @@ test_expect_success 'creating too deep nesting' \ git clone -l -s D E && git clone -l -s E F && git clone -l -s F G && -git clone -l -s G H' +git clone --bare -l -s G H' test_expect_success 'invalidity of deepest repository' \ 'cd H && { -- cgit v1.2.1 From 0433ad128c59f233046b3f8a68246ca3a8a77af8 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 25 Mar 2013 16:26:27 -0400 Subject: clone: run check_everything_connected When we fetch from a remote, we do a revision walk to make sure that what we received is connected to our existing history. We do not do the same check for clone, which should be able to check that we received an intact history graph. The upside of this patch is that it will make clone more resilient against propagating repository corruption. The downside is that we will now traverse "rev-list --objects --all" down to the roots, which may take some time (it is especially noticeable for a "--local --bare" clone). Note that we need to adjust t5710, which tries to make such a bogus clone. Rather than checking after the fact that our clone is bogus, we can simplify it to just make sure "git clone" reports failure. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t5710-info-alternate.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 't/t5710-info-alternate.sh') diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh index 5a6e49d18d..8956c21617 100755 --- a/t/t5710-info-alternate.sh +++ b/t/t5710-info-alternate.sh @@ -58,13 +58,7 @@ test_expect_success 'creating too deep nesting' \ git clone -l -s D E && git clone -l -s E F && git clone -l -s F G && -git clone --bare -l -s G H' - -test_expect_success 'invalidity of deepest repository' \ -'cd H && { - test_valid_repo - test $? -ne 0 -}' +test_must_fail git clone --bare -l -s G H' cd "$base_dir" -- cgit v1.2.1 From 125a05fd0b45416558923b753f6418c24208d443 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 8 Jul 2013 03:30:41 -0400 Subject: clone: drop connectivity check for local clones Commit 0433ad1 (clone: run check_everything_connected, 2013-03-25) added the same connectivity check to clone that we use for fetching. The intent was to provide enough safety checks that "git clone git://..." could be counted on to detect bit errors and other repo corruption, and not silently propagate them to the clone. For local clones, this turns out to be a bad idea, for two reasons: 1. Local clones use hard linking (or even shared object stores), and so complete far more quickly. The time spent on the connectivity check is therefore proportionally much more painful. 2. Local clones do not actually meet our safety guarantee anyway. The connectivity check makes sure we have all of the objects we claim to, but it does not check for bit errors. We will notice bit errors in commits and trees, but we do not load blob objects at all. Whereas over the pack transport, we actually recompute the sha1 of each object in the incoming packfile; bit errors change the sha1 of the object, which is then caught by the connectivity check. This patch drops the connectivity check in the local case. Note that we have to revert the changes from 0433ad1 to t5710, as we no longer notice the corruption during clone. We could go a step further and provide a "verify even local clones" option, but it is probably not worthwhile. You can already spell that as "cd foo.git && git fsck && git clone ." or as "git clone --no-local foo.git". Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t5710-info-alternate.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 't/t5710-info-alternate.sh') diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh index 8956c21617..5a6e49d18d 100755 --- a/t/t5710-info-alternate.sh +++ b/t/t5710-info-alternate.sh @@ -58,7 +58,13 @@ test_expect_success 'creating too deep nesting' \ git clone -l -s D E && git clone -l -s E F && git clone -l -s F G && -test_must_fail git clone --bare -l -s G H' +git clone --bare -l -s G H' + +test_expect_success 'invalidity of deepest repository' \ +'cd H && { + test_valid_repo + test $? -ne 0 +}' cd "$base_dir" -- cgit v1.2.1