From ea5070c91f23e41a88dec48d2f8d96444c2d647a Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Wed, 25 May 2011 22:10:41 +0200 Subject: Teach read-tree the -n|--dry-run option The option can be used to check if read-tree with the same set of other options like "-m" and "-u" would succeed without actually changing either the index or the working tree. The relevant tests in the t10?? range were extended to do a read-tree -n before the real read-tree to make sure neither the index nor any local files were changed with -n and the same exit code as without -n is returned. The helper functions added for that purpose reside in the new t/lib-read-tree.sh file. The only exception is #13 in t1004 ("unlinking an un-unlink-able symlink"). As this is an issue of wrong directory permissions it is not detected with -n. Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano --- t/t1012-read-tree-df.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 't/t1012-read-tree-df.sh') diff --git a/t/t1012-read-tree-df.sh b/t/t1012-read-tree-df.sh index 9811d467da..a6a04b6b90 100755 --- a/t/t1012-read-tree-df.sh +++ b/t/t1012-read-tree-df.sh @@ -3,6 +3,7 @@ test_description='read-tree D/F conflict corner cases' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-read-tree.sh maketree () { ( @@ -53,7 +54,7 @@ test_expect_success setup ' test_expect_success '3-way (1)' ' settree A-000 && - git read-tree -m -u O-000 A-000 B-000 && + read_tree_u_must_succeed -m -u O-000 A-000 B-000 && checkindex <<-EOF 3 a/b 0 a/b-2/c/d @@ -65,7 +66,7 @@ test_expect_success '3-way (1)' ' test_expect_success '3-way (2)' ' settree A-001 && - git read-tree -m -u O-000 A-001 B-000 && + read_tree_u_must_succeed -m -u O-000 A-001 B-000 && checkindex <<-EOF 3 a/b 0 a/b-2/c/d @@ -78,7 +79,7 @@ test_expect_success '3-way (2)' ' test_expect_success '3-way (3)' ' settree A-010 && - git read-tree -m -u O-010 A-010 B-010 && + read_tree_u_must_succeed -m -u O-010 A-010 B-010 && checkindex <<-EOF 2 t 1 t-0 @@ -92,7 +93,7 @@ test_expect_success '3-way (3)' ' test_expect_success '2-way (1)' ' settree O-020 && - git read-tree -m -u O-020 A-020 && + read_tree_u_must_succeed -m -u O-020 A-020 && checkindex <<-EOF 0 ds/dma/ioat/Makefile 0 ds/dma/ioat/registers.h -- cgit v1.2.3