git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/2] t2013: add test for missing but active submodule
@ 2018-08-27 22:12 Stefan Beller
  2018-08-27 22:12 ` [PATCH 2/2] submodule.c: warn about missing submodule git directories Stefan Beller
  2018-08-29 21:04 ` [PATCH 1/2] t2013: add test for missing but active submodule SZEDER Gábor
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Beller @ 2018-08-27 22:12 UTC (permalink / raw)
  To: git; +Cc: Stefan Beller

When cloning a superproject with the option
 --recurse-submodules='.', it is easy to find yourself wanting
a submodule active, but not having that submodule present in
the modules directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 t/t2013-checkout-submodule.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/t/t2013-checkout-submodule.sh b/t/t2013-checkout-submodule.sh
index 6ef15738e44..c69640fc341 100755
--- a/t/t2013-checkout-submodule.sh
+++ b/t/t2013-checkout-submodule.sh
@@ -63,6 +63,30 @@ test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/
 	! test -s actual
 '
 
+test_expect_success 'setup superproject with historic submodule' '
+	test_create_repo super1 &&
+	test_create_repo sub1 &&
+	test_commit -C sub1 sub_content &&
+	git -C super1 submodule add ../sub1 &&
+	git -C super1 commit -a -m "sub1 added" &&
+	test_commit -C super1 historic_state &&
+	git -C super1 rm sub1 &&
+	git -C super1 commit -a -m "deleted sub" &&
+	test_commit -C super1 new_state &&
+	test_path_is_missing super1/sub &&
+
+	# The important part is to ensure sub1 is not in there any more.
+	# There is another series in flight, that may remove an
+	# empty .gitmodules file entirely.
+	test_must_be_empty super1/.gitmodules
+'
+
+test_expect_failure 'checkout old state with deleted submodule' '
+	test_when_finished "rm -rf super1 sub1 super1_clone" &&
+	git clone --recurse-submodules super1 super1_clone &&
+	git -C super1_clone checkout --recurse-submodules historic_state
+'
+
 KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
 test_submodule_switch_recursing_with_args "checkout"
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-09-07 19:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-27 22:12 [PATCH 1/2] t2013: add test for missing but active submodule Stefan Beller
2018-08-27 22:12 ` [PATCH 2/2] submodule.c: warn about missing submodule git directories Stefan Beller
2018-08-28 18:56   ` Junio C Hamano
2018-08-28 21:49     ` Stefan Beller
2018-08-29 17:16       ` Junio C Hamano
2018-08-29 20:32         ` Stefan Beller
2018-09-05 19:18   ` Jonathan Nieder
2018-09-07 18:49     ` Stefan Beller
2018-09-07 19:53       ` Jonathan Nieder
2018-08-29 21:04 ` [PATCH 1/2] t2013: add test for missing but active submodule SZEDER Gábor

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).