All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org, sbeller@google.com
Subject: Re: [PATCH] Tests: document test_submodule_{,forced_}switch()
Date: Tue, 07 Nov 2017 10:52:25 +0900	[thread overview]
Message-ID: <xmqq8tfihn3a.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171106235021.113358-1-jonathantanmy@google.com> (Jonathan Tan's message of "Mon, 6 Nov 2017 15:50:21 -0800")

Jonathan Tan <jonathantanmy@google.com> writes:

> Factor out the commonalities from test_submodule_switch() and
> test_submodule_forced_switch() in lib-submodule-update.sh, and document
> their usage.
>
> This also makes explicit (through the KNOWN_FAILURE_FORCED_SWITCH_TESTS
> variable) the fact that, currently, all functionality tested using
> test_submodule_forced_switch() do not correctly handle the situation in
> which a submodule is replaced with an ordinary directory.
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> I find tests that use lib-submodule-update.sh difficult to understand
> due to the lack of clarity of what test_submodule_switch() and others do
> with their argument - I hope this will make things easier for future
> readers.
> ---
>  t/lib-submodule-update.sh | 250 +++++++++-------------------------------------
>  1 file changed, 46 insertions(+), 204 deletions(-)

I suspect that the benefit of this is a lot larger than "document" a
test helper function or two ;-)  "document & clean-up", perhaps?

> -	# ... unless there is an untracked file in its place.
> -	test_expect_success "$command: added submodule doesn't remove untracked unignored file with same name" '
> -		prolog &&
> -		reset_work_tree_to no_submodule &&
> -		(
> -			cd submodule_update &&
> -			git branch -t add_sub1 origin/add_sub1 &&
> -			>sub1 &&
> -			test_must_fail $command add_sub1 &&
> -			test_superproject_content origin/no_submodule &&
> -			test_must_be_empty sub1
> -		)
> -	'

This is not included in the _common thing, but is added back to the
updated _switch and _forced_switch, both of which call the _common
thing, at the end.

> @@ -538,59 +529,53 @@ test_submodule_switch () {
>  			test_submodule_content sub1 origin/add_sub1
>  		)
>  	'
> -	# Updating a submodule from an invalid sha1 doesn't update the
> -	# submodule's work tree, subsequent update will succeed
> -	test_expect_$RESULT "$command: modified submodule does not update submodule work tree from invalid commit" '
> -		prolog &&
> -		reset_work_tree_to invalid_sub1 &&
> -		(
> -			cd submodule_update &&
> -			git branch -t valid_sub1 origin/valid_sub1 &&
> -			$command valid_sub1 &&
> -			test_superproject_content origin/valid_sub1 &&
> -			test_dir_is_empty sub1 &&
> -			git submodule update --init --recursive &&
> -			test_submodule_content sub1 origin/valid_sub1
> -		)
> -	'

This piece seems to have been lost from the updated code; _common
does not inherit this test, and _switch does not add it back after
calling _common.  Its copy does appear in _forced_switch, though.


I didn't compare the before-and-after with fine toothed comb, but
a cursory look didn't find anything glaringly questionable other
than the above.



  reply	other threads:[~2017-11-07  1:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-06 23:50 [PATCH] Tests: document test_submodule_{,forced_}switch() Jonathan Tan
2017-11-07  1:52 ` Junio C Hamano [this message]
2017-11-07 17:27   ` Stefan Beller
2017-11-07 18:45   ` [PATCH v2] Tests: clean up and document submodule helpers Jonathan Tan

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=xmqq8tfihn3a.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=sbeller@google.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.