Re: [PATCH v2] submodules: fix of regression on fetching of non-init subsub-repo
- From
Philippe Blain <levraiphilippeblain@gmail.com>
- Date
- Dec 7, 2020, 20:44 UTC
- Message-ID
- <BF6B37E9-5AF9-4A81-90D8-0270D1269332@gmail.com>
- In-Reply-To
- <xmqq360hbev1.fsf@gitster.c.googlers.com>
Hi Junio,
Show 37 quoted lines
> Le 7 déc. 2020 à 14:22, Junio C Hamano <gitster@pobox.com> a écrit :
>
> Peter Kaestle <peter.kaestle@nokia.com> writes:
>
>> +add_commit_push () {
>> + dir="$1" &&
>> + msg="$2" &&
>> + shift 2 &&
>> + git -C "$dir" add "$@" &&
>> + git -C "$dir" commit -a -m "$msg" &&
>> + git -C "$dir" push
>> +}
>> +
>> +compare_refs_in_dir () {
>> + fail= &&
>> + if test "x$1" = 'x!'
>> + then
>> + fail='!' &&
>> + shift
>> + fi &&
>> + git -C "$1" rev-parse --verify "$2" >expect &&
>> + git -C "$3" rev-parse --verify "$4" >actual &&
>> + eval $fail test_cmp expect actual
>> +}
>
>
>
>> +test_expect_success 'fetching a superproject containing an uninitialized sub/sub project' '
>> + # depends on previous test for setup
>> +
>> + git -C B/ fetch &&
>> + compare_refs_in_dir A origin/master B origin/master
>
> Can we do this without relying on the name of the default branch?
> Perhaps when outer, middle and inner are prepared, they can be
> forced to be on the 'sample' (not 'master' nor 'main') branch, or
> something like that?Or, simpler, we could call "git remote set-head -a' in A and B in the setup script, which would make origin/HEAD in A and B point to the default branch, such that the call here could be :
compare_refs_in_dir A origin/HEAD B origin/HEAD
Philippe.