git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Philippe Blain <levraiphilippeblain@gmail.com>
Date
Nov 11, 2020, 19:24 UTC
Message-ID
<48197610-9B5B-43A0-9748-AB71B061858A@gmail.com>
In-Reply-To
<1604910829-49109-2-git-send-email-peter.kaestle@nokia.com>
Hi Peter,
Show 38 quoted lines
> Le 9 nov. 2020 à 03:33, Peter Kaestle <peter.kaestle@nokia.com> 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

Previous: Junio C Hamano
Message 14 of 14 in “[REGRESSION FIX 0/2] Handling regression introduced by a62387b”
  1. Peter KaestleNov 3, 2020
  2. 1/2 submodules: test for fetch of non-init subsub-repoPeter Kaestle, Nov 3, 2020
  3. 2/2 Revert "submodule.c: fetch in submodules git directory instead of in worktree"Peter Kaestle, Nov 3, 2020
  4. 0/2 Handling regression introduced by a62387bPeter Kaestle, Nov 9, 2020
  5. 2/2 Revert "submodule.c: fetch in submodules git directory instead of in worktree"Peter Kaestle, Nov 9, 2020
  6. Johannes SchindelinNov 10, 2020
  7. 1/2 submodules: test for fetch of non-init subsub-repoPeter Kaestle, Nov 9, 2020
  8. Junio C HamanoNov 9, 2020
  9. Peter KästleNov 11, 2020
  10. Philip OakleyNov 11, 2020
  11. [RFCv2] submodules: fix of regression on fetching of non-init subsub-repoPeter Kaestle, Nov 12, 2020
  12. Philippe BlainNov 11, 2020
  13. Junio C HamanoNov 11, 2020
  14. Philippe BlainNov 11, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.