Thread (8 messages) 8 messages, 3 authors, 2020-11-11

Re: [RFC 1/2] submodules: test for fetch of non-init subsub-repo

From: Philippe Blain <hidden>
Date: 2020-11-11 19:24:51

Hi Peter,

quoted hunk ↗ jump to hunk
Le 9 nov. 2020 à 03:33, Peter Kaestle [off-list ref] a écrit :
--- snip ---

+add_commit_push()
+{
+	dir="$1"
+	msg="$2"
+	shift 2
+	git -C "$dir" add "$@" &&
+	git -C "$dir" commit -a -m "$msg" &&
+	git -C "$dir" push
+}
+
+test_expect_failure 'fetching a superproject containing an uninitialized sub/sub project' '
+	# does not depend on any previous test setups
+
+	for repo in outer middle inner
+	do
+		git init --bare $repo &&
+		git clone $repo ${repo}_content &&
+		echo $repo > ${repo}_content/file &&
+		add_commit_push ${repo}_content "initial" file
+	done &&
+
+	git clone outer A &&
+	git -C A submodule add "$pwd/middle" &&
+	git -C A/middle/ submodule add "$pwd/inner" &&
+	add_commit_push A/middle/ "adding inner sub" .gitmodules inner &&
+	add_commit_push A/ "adding middle sub" .gitmodules middle &&
+
+	git clone outer B &&
+	git -C B/ submodule update --init middle &&
+
+	echo "change on inner repo of A" > A/middle/inner/file &&
+	add_commit_push A/middle/inner "change on inner" file &&
+	add_commit_push A/middle "change on inner" inner &&
+	add_commit_push A "change on inner" middle &&
In addition to what Junio wrote, maybe your test could make better use of the 
functions provided by the test harness library. Take a look at t/README [1] for a 
partial list, and t/test-lib-functions.sh [2] for the full list. test_create_repo, in particular,
could be useful.

Cheers,

Philippe.


[1] https://github.com/git/git/blob/master/t/README#L743
[2] https://github.com/git/git/blob/master/t/test-lib-functions.sh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help