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