All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: phillip.wood@dunelm.org.uk,
	 "brian m. carlson" <sandals@crustytoothpaste.net>,
	 git@vger.kernel.org
Subject: Re: [PATCH 1/2] t0014: factor out choice of deprecated commands
Date: Tue, 28 Jul 2026 08:57:39 -0700	[thread overview]
Message-ID: <xmqqwlufds3w.fsf@gitster.g> (raw)
In-Reply-To: <20260728143726.GA41686@coredump.intra.peff.net> (Jeff King's message of "Tue, 28 Jul 2026 10:37:26 -0400")

Jeff King <peff@peff.net> writes:

> We have a few tests related to aliasing deprecated commands which use
> "whatchanged" and "pack-redundant", as these are the only two deprecated
> commands we have. Let's pull those names into variables so that we can
> refactor the tests without relying on the specific names.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> I pulled this into its own patch because it's so noisy, but it could be
> squashed with the subsequent one.

The knee-jerk reaction I got after reading the above explanation
before the morning caffeine fully taking effect and without looking
at [2/2] is "we may have parameterized the exact command names, but
I cannot tell what value this change has, as the fact that we have
exactly two deprecated commands is still hardcoded in the test".

If the point of this change is that even if we ever deprecated a
third command, this test does not need to care about it, then I can
understand it is perfectly fine to have the hardcoded "this test
uses two deprecated commands" while parameterizing which two
commands are used.  But then the log message may be a bit
misleading.  I dunno.

I am very sure that I will be enlightened when I read [2/2], though
;-)

>  t/t0014-alias.sh | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/t/t0014-alias.sh b/t/t0014-alias.sh
> index 5144b0effd..9d7c737355 100755
> --- a/t/t0014-alias.sh
> +++ b/t/t0014-alias.sh
> @@ -27,17 +27,20 @@ test_expect_success 'looping aliases - internal execution' '
>  	test_grep "^fatal: alias loop detected: expansion of" output
>  '
>  
> +deprecated1=whatchanged
> +deprecated2=pack-redundant
> +
>  test_expect_success 'looping aliases - deprecated builtins' '
> -	test_config alias.whatchanged pack-redundant &&
> -	test_config alias.pack-redundant whatchanged &&
> +	test_config alias.$deprecated1 $deprecated2 &&
> +	test_config alias.$deprecated2 $deprecated1 &&
>  	cat >expect <<-EOF &&
> -	${SQ}whatchanged${SQ} is aliased to ${SQ}pack-redundant${SQ}
> -	${SQ}pack-redundant${SQ} is aliased to ${SQ}whatchanged${SQ}
> -	fatal: alias loop detected: expansion of ${SQ}whatchanged${SQ} does not terminate:
> -	  whatchanged <==
> -	  pack-redundant ==>
> +	${SQ}$deprecated1${SQ} is aliased to ${SQ}$deprecated2${SQ}
> +	${SQ}$deprecated2${SQ} is aliased to ${SQ}$deprecated1${SQ}
> +	fatal: alias loop detected: expansion of ${SQ}$deprecated1${SQ} does not terminate:
> +	  $deprecated1 <==
> +	  $deprecated2 ==>
>  	EOF
> -	test_must_fail git whatchanged -h 2>actual &&
> +	test_must_fail git $deprecated1 -h 2>actual &&
>  	test_cmp expect actual
>  '
>  
> @@ -90,8 +93,8 @@ test_expect_success 'can alias-shadow via two deprecated builtins' '
>  	# some git(1) commands will fail... (see above)
>  	test_might_fail git status -h >expect &&
>  	test_file_not_empty expect &&
> -	test_might_fail git -c alias.whatchanged=pack-redundant \
> -		-c alias.pack-redundant=status whatchanged -h >actual &&
> +	test_might_fail git -c alias.$deprecated1=$deprecated2 \
> +		-c alias.$deprecated2=status $deprecated1 -h >actual &&
>  	test_cmp expect actual
>  '

  reply	other threads:[~2026-07-28 15:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28  0:46 Failing tests with WITH_BREAKING_CHANGES brian m. carlson
2026-07-28  1:00 ` Junio C Hamano
2026-07-28 13:31 ` Phillip Wood
2026-07-28 13:55   ` Jeff King
2026-07-28 14:36     ` [PATCH 0/2] fix serial tests without/with breaking-changes Jeff King
2026-07-28 14:37       ` [PATCH 1/2] t0014: factor out choice of deprecated commands Jeff King
2026-07-28 15:57         ` Junio C Hamano [this message]
2026-07-28 14:38       ` [PATCH 2/2] t0014: generate deprecated command names dynamically Jeff King
2026-07-28 16:01         ` Junio C Hamano
2026-07-28 16:19           ` Jeff King

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=xmqqwlufds3w.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sandals@crustytoothpaste.net \
    /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.