From: Stefan Beller <sbeller@google.com>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: Junio C Hamano <gitster@pobox.com>,
Jonathan Nieder <jrnieder@gmail.com>,
Jens Lehmann <Jens.Lehmann@web.de>,
Brandon Williams <bmwill@google.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH v4 1/3] fetch: add test to make sure we stay backwards compatible
Date: Tue, 17 Oct 2017 10:56:24 -0700 [thread overview]
Message-ID: <CAGZ79kaA6myLpDcN2H4sdbMKvkuVRp4Zud==k=p1BNfWn95a4Q@mail.gmail.com> (raw)
In-Reply-To: <20171016135715.GB12756@book.hvoigt.net>
On Mon, Oct 16, 2017 at 6:57 AM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
> The current implementation of submodules supports on-demand fetch if
> there is no .gitmodules entry for a submodule. Let's add a test to
> document this behavior.
>
> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
> ---
> t/t5526-fetch-submodules.sh | 42 +++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
> index 42251f7f3a..43a22f680f 100755
> --- a/t/t5526-fetch-submodules.sh
> +++ b/t/t5526-fetch-submodules.sh
> @@ -478,7 +478,47 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
> git fetch >../actual.out 2>../actual.err
> ) &&
> ! test -s actual.out &&
> - test_i18ncmp expect.err actual.err
> + test_i18ncmp expect.err actual.err &&
> + (
> + cd submodule &&
> + git checkout -q master
> + )
For few instructions inside another repo, I tend to use the
-C option:
git -C submodule checkout -q master
That saves a shell, which is noticeable cost on Windows I was told.
(also fewer lines to type).
Oh, I see, that is consistent with the rest of the file. Oh well.
(Otherwise I would have lobbied to even move it further up and
put it inside a test_when_finished "<cmd>"
> +'
> +
> +test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .gitmodule entry" '
> + (
> + cd downstream &&
> + git fetch --recurse-submodules
> + ) &&
This is consistent with the rest of the file as well, so I shall
refrain from complaining. ;)
> + add_upstream_commit &&
> + head1=$(git rev-parse --short HEAD) &&
> + git add submodule &&
> + git rm .gitmodules &&
> + git commit -m "new submodule without .gitmodules" &&
> + printf "" >expect.out &&
This could be just
: >expect.out
no need to invoke a function to print nothing.
> + head2=$(git rev-parse --short HEAD) &&
> + echo "From $pwd/." >expect.err.2 &&
> + echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
> + head -3 expect.err >>expect.err.2 &&
> + (
> + cd downstream &&
> + rm .gitmodules &&
> + git config fetch.recurseSubmodules on-demand &&
> + # fake submodule configuration to avoid skipping submodule handling
> + git config -f .gitmodules submodule.fake.path fake &&
> + git config -f .gitmodules submodule.fake.url fakeurl &&
> + git add .gitmodules &&
> + git config --unset submodule.submodule.url &&
> + git fetch >../actual.out 2>../actual.err &&
> + # cleanup
> + git config --unset fetch.recurseSubmodules &&
> + git reset --hard
> + ) &&
> + test_i18ncmp expect.out actual.out &&
> + test_i18ncmp expect.err.2 actual.err &&
> + git checkout HEAD^ -- .gitmodules &&
> + git add .gitmodules &&
> + git commit -m "new submodule restored .gitmodules"
> '
Thanks for writing this test.
With or without the nits addressed, this is
Reviewed-by: Stefan Beller <sbeller@google.com>
next prev parent reply other threads:[~2017-10-17 17:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 13:56 [PATCH v4 0/3] implement fetching of moved submodules Heiko Voigt
2017-10-16 13:57 ` [PATCH v4 1/3] fetch: add test to make sure we stay backwards compatible Heiko Voigt
2017-10-17 17:56 ` Stefan Beller [this message]
2017-10-16 13:58 ` [PATCH v4 2/3] implement fetching of moved submodules Heiko Voigt
2017-10-17 17:47 ` Stefan Beller
2017-10-18 0:03 ` Junio C Hamano
2017-10-18 17:56 ` Stefan Beller
2017-10-19 0:35 ` Junio C Hamano
2017-10-19 18:11 ` [PATCH 1/2] t5526: check for name/path collision in submodule fetch Stefan Beller
2017-10-19 18:11 ` [PATCH 2/2] fetch, push: keep separate lists of submodules and gitlinks Stefan Beller
2017-10-23 14:12 ` Heiko Voigt
2017-10-23 18:05 ` Stefan Beller
2017-10-24 0:54 ` Junio C Hamano
2017-10-23 14:16 ` [PATCH 1/2] t5526: check for name/path collision in submodule fetch Heiko Voigt
2017-10-23 17:58 ` Stefan Beller
2017-10-19 23:34 ` [PATCH v4 2/3] implement fetching of moved submodules Stefan Beller
2017-10-16 13:59 ` [PATCH v4 3/3] submodule: simplify decision tree whether to or not to fetch Heiko Voigt
2017-10-17 18:22 ` Stefan Beller
2017-10-18 0:03 ` Junio C Hamano
2017-10-18 18:03 ` Brandon Williams
2017-10-19 0:36 ` Junio C Hamano
2017-10-19 15:38 ` Heiko Voigt
2017-10-19 19:16 ` Brandon Williams
2017-10-17 1:49 ` [PATCH v4 0/3] implement fetching of moved submodules Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGZ79kaA6myLpDcN2H4sdbMKvkuVRp4Zud==k=p1BNfWn95a4Q@mail.gmail.com' \
--to=sbeller@google.com \
--cc=Jens.Lehmann@web.de \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).