From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD3401366 for ; Mon, 30 Oct 2023 00:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b="FpBTSHF7" Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4CA6B7 for ; Sun, 29 Oct 2023 17:33:24 -0700 (PDT) Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 593521C3F39; Sun, 29 Oct 2023 20:33:24 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=XrxIWkRGKCn9Ji1mSzvqua5gRrOBSvIlGvVYax CXQiY=; b=FpBTSHF74SSbsgNDvcdIxfAap/0qYj0HZhToKxiu7ezN4ch0ScS8Vl F7NwxrrA95wqmZNae0R1sRPSDVYPlu+BDNCQpVl41z8Obj5QXYXby1XeUty/+d4I dG/qnMF6PBJP91Ov5DmzTSctSNfgU6+kH7BEcDuvcQwKfRbsiIxMU= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 4F7A41C3F38; Sun, 29 Oct 2023 20:33:24 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.125.198.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id A59031C3F37; Sun, 29 Oct 2023 20:33:23 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Phillip Wood Cc: Eric Sunshine , emilyshaffer@google.com, git@vger.kernel.org, Emily Shaffer , Sheik , Dragan Simic Subject: Re: [PATCH v3] bugreport: reject positional arguments In-Reply-To: (Junio C. Hamano's message of "Mon, 30 Oct 2023 09:26:31 +0900") References: <20231026005542.872301-1-nasamuffin@google.com> <20231026155459.2234929-1-nasamuffin@google.com> <3e15f266-c790-4b71-84b6-1328339425c1@gmail.com> Date: Mon, 30 Oct 2023 09:33:22 +0900 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: EF122E76-76BB-11EE-966D-78DCEB2EC81B-77302942!pb-smtp1.pobox.com Junio C Hamano writes: > Phillip Wood writes: > >> It is rather unfortunate that test_i18ngrep was deprecated without >> providing an alternative that offers the same debugging >> experience. > > The primary thing test_i18ngrep did was to _SKIP_ certain test that > looked for an expected string in "C" locale from the output when the > tests were run under a tainted localization mode. The tests that > looked for strings in messages that are *not* to be localized used > "grep". Tests that (unfortunately) had to match human-readable > messages had to work around the tainted localization test to use > test_i18ngrep. > >> When test_i18ngrep fails it prints a message with the >> pattern and text that failed to match so it is easy to see where the >> test failed. If grep fails there is no output and so unless the test >> is run with "-x" it can be hard to see which command caused the test >> to fail. > > We could rename test_i18ngrep to test_grep (and make test_i18ngrep > into a thin wrapper with warnings). > > test_grep -e must-exist file && > test_grep ! -e must-not-exist file ... as the only remaining part in test_18ngrep has no hack to work around the tainted localization tests, so "was deprecated without" is a bit too strong. There is nothing we have lost yet. t/test-lib-functions.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git c/t/test-lib-functions.sh w/t/test-lib-functions.sh index 2f8868caa1..c50bc18861 100644 --- c/t/test-lib-functions.sh +++ w/t/test-lib-functions.sh @@ -1208,14 +1208,16 @@ test_cmp_bin () { cmp "$@" } -# Wrapper for grep which used to be used for -# GIT_TEST_GETTEXT_POISON=false. Only here as a shim for other -# in-flight changes. Should not be used and will be removed soon. +# Deprecated - do not use this in new code test_i18ngrep () { + test_grep "$@" +} + +test_grep () { eval "last_arg=\${$#}" test -f "$last_arg" || - BUG "test_i18ngrep requires a file to read as the last parameter" + BUG "test_grep requires a file to read as the last parameter" if test $# -lt 2 || { test "x!" = "x$1" && test $# -lt 3 ; }