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

Re: [WIP/PATCH 3/9] Teach checkout the --[no-]recurse-submodules option

From
Jens Lehmann <jens.lehmann@web.de>
Date
Feb 7, 2014, 21:12 UTC
Message-ID
<52F54C56.5020604@web.de>
In-Reply-To
<xmqq8utrdcuh.fsf@gitster.dls.corp.google.com>
Am 03.02.2014 23:56, schrieb Junio C Hamano:
Show 10 quoted lines
> 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.
Show 69 quoted lines
>> 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.

Previous: Junio C HamanoNext: Jens Lehmann
Message 17 of 35 in “What's cooking in git.git (Jan 2014, #01; Mon, 6)”
  1. Junio C HamanoJan 6, 2014
  2. Francesco PrettoJan 6, 2014
  3. Junio C HamanoJan 6, 2014
  4. Francesco PrettoJan 6, 2014
  5. Jens LehmannJan 7, 2014
  6. 0/9 v2 submodule recursive checkout]Jens Lehmann, Feb 3, 2014
  7. 1/9 submodule: prepare for recursive checkout of submodulesJens Lehmann, Feb 3, 2014
  8. Junio C HamanoFeb 3, 2014
  9. Jens LehmannFeb 7, 2014
  10. Jonathan NiederFeb 4, 2014
  11. Jens LehmannFeb 7, 2014
  12. 2/9 Teach reset the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  13. Junio C HamanoFeb 3, 2014
  14. Jens LehmannFeb 7, 2014
  15. 3/9 Teach checkout the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  16. Junio C HamanoFeb 3, 2014
  17. Jens LehmannFeb 7, 2014
  18. 4/9 Teach merge the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  19. Junio C HamanoFeb 3, 2014
  20. Jens LehmannFeb 7, 2014
  21. Junio C HamanoFeb 7, 2014
  22. W. Trevor KingFeb 7, 2014
  23. 5/9 Teach bisect--helper the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  24. 6/9 Teach bisect the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  25. W. Trevor KingFeb 3, 2014
  26. Jens LehmannFeb 3, 2014
  27. 7/9 submodule: teach unpack_trees() to remove submodule contentsJens Lehmann, Feb 3, 2014
  28. W. Trevor KingFeb 3, 2014
  29. Jens LehmannFeb 7, 2014
  30. 8/9 submodule: teach unpack_trees() to repopulate submodulesJens Lehmann, Feb 3, 2014
  31. 9/9 submodule: teach unpack_trees() to update submodulesJens Lehmann, Feb 3, 2014
  32. W. Trevor KingFeb 3, 2014
  33. Jens LehmannFeb 7, 2014
  34. Duy NguyenFeb 4, 2014
  35. Jens LehmannFeb 7, 2014

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.