git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Heiko Voigt <hvoigt@hvoigt.net>,
	"W. Trevor King" <wking@tremily.us>
Subject: Re: [WIP/PATCH 3/9] Teach checkout the --[no-]recurse-submodules option
Date: Fri, 07 Feb 2014 22:12:54 +0100	[thread overview]
Message-ID: <52F54C56.5020604@web.de> (raw)
In-Reply-To: <xmqq8utrdcuh.fsf@gitster.dls.corp.google.com>

Am 03.02.2014 23:56, schrieb Junio C Hamano:
> Jens Lehmann <Jens.Lehmann@web.de> writes:
> 
>> +	set_config_update_recurse_submodules(
>> +		parse_update_recurse_submodules_arg("--recurse-submodules-default",
>> +						    recurse_submodules_default),
>> +		recurse_submodules);
> 
> I think I saw these exact lines in another patch.  Perhaps the whole
> thing can become a helper function that lets the caller avoid typing
> the whole long strings that needs a strange/unfortunate line break? 

Right, that'd be better.

>> diff --git a/t/t2013-checkout-submodule.sh b/t/t2013-checkout-submodule.sh
>> index 06b18f8..bc3e1ca 100755
>> --- a/t/t2013-checkout-submodule.sh
>> +++ b/t/t2013-checkout-submodule.sh
>> @@ -4,17 +4,57 @@ test_description='checkout can handle submodules'
>>
>>  . ./test-lib.sh
>>
>> +submodule_creation_must_succeed() {
> 
> Style: SP before (), i.e.
> 
> 	submodule_creation_must_succeed () {
> 
>> +	# checkout base ($1)
>> +	git checkout -f --recurse-submodules $1 &&
>> +	git diff-files --quiet &&
>> +	git diff-index --quiet --cached $1 &&
> 
> Please make it a habit to quote a parameter that is intended not to
> be split at $IFS (e.g. write these as "$1" not as $1).  Otherwise
> the reader has to wonder if this can be called with a "foo bar" and
> the expects it to be split into two.
> 
>> +	# checkout target ($2)
>> +	if test -d submodule; then
> 
> Style: no semicolons in standard control structure, i.e.
> 
> 	if test -d submodule
> 	then
> 
>> +		echo change>>submodule/first.t &&
> 
> Style: SP before but not after redirection operator, i.e.
> 
> 	echo foo >>bar
> 
>> +submodule_removal_must_succeed() {
> 
> Likewise.
> 
>> +	# checkout base ($1)
>> +	git checkout -f --recurse-submodules $1 &&
> 
> Likewise.
> 
>> +	echo first > file &&
> 
> Likewise.
> 
>> +test_expect_success '"checkout --recurse-submodules" replaces submodule with files' '
>> +	git checkout -f base &&
>> +	git checkout -b replace_submodule_with_dir &&
>> +	git update-index --force-remove submodule &&
>> +	rm -rf submodule/.git .gitmodules &&
>> +	git add .gitmodules submodule/* &&
>> +	git commit -m "submodule replaced" &&
>> +	git checkout -f base &&
>> +	git submodule update -f &&
>> +	git checkout --recurse-submodules replace_submodule_with_dir &&
>> +	test -d submodule &&
>> +	! test -e submodule/.git &&
>> +	test -f submodule/first.t &&
>> +	test -f submodule/second.t
>> +'
> 
> Hmmmm.  Is it sufficient for these files to just exist, or do we
> want to make sure they have expected contents?

Thanks, will consider all you remarks above in the ongoing work for
testing framework which should replace these tests.

  reply	other threads:[~2014-02-07 21:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 22:36 What's cooking in git.git (Jan 2014, #01; Mon, 6) Junio C Hamano
2014-01-06 23:16 ` Francesco Pretto
2014-01-06 23:32   ` Junio C Hamano
2014-01-06 23:45     ` Francesco Pretto
2014-01-07 17:49 ` Jens Lehmann
     [not found]   ` <xmqqvbxvekwv.fsf@gitster.dls.corp.google.com>
2014-02-03 19:47     ` [WIP/PATCH 0/9] v2 submodule recursive checkout] Jens Lehmann
2014-02-03 19:48       ` [WIP/PATCH 1/9] submodule: prepare for recursive checkout of submodules Jens Lehmann
2014-02-03 22:23         ` Junio C Hamano
2014-02-07 21:06           ` Jens Lehmann
2014-02-04  0:01         ` Jonathan Nieder
2014-02-07 21:01           ` Jens Lehmann
2014-02-03 19:49       ` [WIP/PATCH 2/9] Teach reset the --[no-]recurse-submodules option Jens Lehmann
2014-02-03 22:40         ` Junio C Hamano
2014-02-07 21:09           ` Jens Lehmann
2014-02-03 19:50       ` [WIP/PATCH 3/9] Teach checkout " Jens Lehmann
2014-02-03 22:56         ` Junio C Hamano
2014-02-07 21:12           ` Jens Lehmann [this message]
2014-02-03 19:50       ` [WIP/PATCH 4/9] Teach merge " Jens Lehmann
2014-02-03 23:01         ` Junio C Hamano
2014-02-07 21:23           ` Jens Lehmann
2014-02-07 22:00             ` Junio C Hamano
2014-02-07 22:08               ` W. Trevor King
2014-02-03 19:51       ` [WIP/PATCH 5/9] Teach bisect--helper " Jens Lehmann
2014-02-03 19:51       ` [WIP/PATCH 6/9] Teach bisect " Jens Lehmann
2014-02-03 20:04         ` W. Trevor King
2014-02-03 20:22           ` Jens Lehmann
2014-02-03 19:52       ` [WIP/PATCH 7/9] submodule: teach unpack_trees() to remove submodule contents Jens Lehmann
2014-02-03 20:10         ` W. Trevor King
2014-02-07 21:24           ` Jens Lehmann
2014-02-03 19:53       ` [WIP/PATCH 8/9] submodule: teach unpack_trees() to repopulate submodules Jens Lehmann
2014-02-03 19:54       ` [WIP/PATCH 9/9] submodule: teach unpack_trees() to update submodules Jens Lehmann
2014-02-03 20:19         ` W. Trevor King
2014-02-07 21:25           ` Jens Lehmann
2014-02-04  0:11         ` Duy Nguyen
2014-02-07 21:32           ` Jens Lehmann

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52F54C56.5020604@web.de \
    --to=jens.lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hvoigt@hvoigt.net \
    --cc=jrnieder@gmail.com \
    --cc=wking@tremily.us \
    /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.
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 NNTP newsgroup(s).