git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Cc: "Slavica Đukić" <slawica92@hotmail.com>,
	"Denton Liu" <liu.denton@gmail.com>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 2/2] add -i: default to the built-in implementation
Date: Wed, 1 Dec 2021 11:20:31 +0000	[thread overview]
Message-ID: <a936a701-c13f-346e-69ee-85441ca20641@gmail.com> (raw)
In-Reply-To: <84824918ae4564a9194a1a55124ee8694f210437.1638281655.git.gitgitgadget@gmail.com>

Hi Dscho

On 30/11/2021 14:14, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> In 9a5315edfdf (Merge branch 'js/patch-mode-in-others-in-c',
> 2020-02-05), Git acquired a built-in implementation of `git add`'s
> interactive mode that could be turned on via the config option
> `add.interactive.useBuiltin`.
> 
> The first official Git version to support this knob was v2.26.0.
> 
> In 2df2d81ddd0 (add -i: use the built-in version when
> feature.experimental is set, 2020-09-08), this built-in implementation
> was also enabled via `feature.experimental`. The first version with this
> change was v2.29.0.
> 
> More than a year (and very few bug reports) later, it is time to declare
> the built-in implementation mature and to turn it on by default.
> 
> We specifically leave the `add.interactive.useBuiltin` configuration in
> place, to give users an "escape hatch" in the unexpected case should
> they encounter a previously undetected bug in that implementation.

Thanks for doing this, I agree it is time to switch over - it feels like 
it is quite a while since anyone reported a bug with the C version. Both 
patches look good to me. I've left one minor comment below but it is not 
worth re-rolling just for that. Thanks Slavica for your work on this, 
it's great to have it converted to C.


> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>   Documentation/config/add.txt |  6 +++---
>   builtin/add.c                | 15 +++++----------
>   ci/run-build-and-tests.sh    |  2 +-
>   t/README                     |  2 +-
>   t/t2016-checkout-patch.sh    |  2 +-
>   5 files changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/Documentation/config/add.txt b/Documentation/config/add.txt
> index c9f748f81cb..3e859f34197 100644
> --- a/Documentation/config/add.txt
> +++ b/Documentation/config/add.txt
> @@ -7,6 +7,6 @@ add.ignore-errors (deprecated)::
>   	variables.
>   
>   add.interactive.useBuiltin::
> -	[EXPERIMENTAL] Set to `true` to use the experimental built-in
> -	implementation of the interactive version of linkgit:git-add[1]
> -	instead of the Perl script version. Is `false` by default.
> +	Set to `false` to fall back to the original Perl implementation of
> +	the interactive version of linkgit:git-add[1] instead of the built-in
> +	version. Is `true` by default.
> diff --git a/builtin/add.c b/builtin/add.c
> index ef6b619c45e..8ef230a345b 100644
> --- a/builtin/add.c
> +++ b/builtin/add.c
> @@ -237,17 +237,12 @@ int run_add_interactive(const char *revision, const char *patch_mode,
>   	int use_builtin_add_i =
>   		git_env_bool("GIT_TEST_ADD_I_USE_BUILTIN", -1);
>   
> -	if (use_builtin_add_i < 0) {
> -		int experimental;
> -		if (!git_config_get_bool("add.interactive.usebuiltin",
> -					 &use_builtin_add_i))
> -			; /* ok */
> -		else if (!git_config_get_bool("feature.experimental", &experimental) &&
> -			 experimental)
> -			use_builtin_add_i = 1;
> -	}
> +	if (use_builtin_add_i < 0 &&
> +	    git_config_get_bool("add.interactive.usebuiltin",
> +				&use_builtin_add_i))
> +		use_builtin_add_i = 1;
>   
> -	if (use_builtin_add_i == 1) {
> +	if (use_builtin_add_i != 0) {

This could be simplified to "if (use_builtin_add_i)" but don't re-roll 
just for that

Best Wishes

Phillip

>   		enum add_p_mode mode;
>   
>   		if (!patch_mode)
> diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh
> index cc62616d806..660ebe8d108 100755
> --- a/ci/run-build-and-tests.sh
> +++ b/ci/run-build-and-tests.sh
> @@ -29,7 +29,7 @@ linux-gcc)
>   	export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
>   	export GIT_TEST_MULTI_PACK_INDEX=1
>   	export GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1
> -	export GIT_TEST_ADD_I_USE_BUILTIN=1
> +	export GIT_TEST_ADD_I_USE_BUILTIN=0
>   	export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
>   	export GIT_TEST_WRITE_REV_INDEX=1
>   	export GIT_TEST_CHECKOUT_WORKERS=2
> diff --git a/t/README b/t/README
> index 29f72354bf1..2c22337d6e7 100644
> --- a/t/README
> +++ b/t/README
> @@ -419,7 +419,7 @@ the --sparse command-line argument.
>   GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path
>   by overriding the minimum number of cache entries required per thread.
>   
> -GIT_TEST_ADD_I_USE_BUILTIN=<boolean>, when true, enables the
> +GIT_TEST_ADD_I_USE_BUILTIN=<boolean>, when false, disables the
>   built-in version of git add -i. See 'add.interactive.useBuiltin' in
>   git-config(1).
>   
> diff --git a/t/t2016-checkout-patch.sh b/t/t2016-checkout-patch.sh
> index 71c5a15be00..bc3f69b4b1d 100755
> --- a/t/t2016-checkout-patch.sh
> +++ b/t/t2016-checkout-patch.sh
> @@ -4,7 +4,7 @@ test_description='git checkout --patch'
>   
>   . ./lib-patch-mode.sh
>   
> -if ! test_bool_env GIT_TEST_ADD_I_USE_BUILTIN false && ! test_have_prereq PERL
> +if ! test_bool_env GIT_TEST_ADD_I_USE_BUILTIN true && ! test_have_prereq PERL
>   then
>   	skip_all='skipping interactive add tests, PERL not set'
>   	test_done
> 


  reply	other threads:[~2021-12-01 11:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 14:14 [PATCH 0/2] Use the built-in implementation of the interactive add command by default Johannes Schindelin via GitGitGadget
2021-11-30 14:14 ` [PATCH 1/2] t2016: require the PERL prereq only when necessary Johannes Schindelin via GitGitGadget
2021-12-01 22:25   ` Junio C Hamano
2021-12-02 14:57     ` Johannes Schindelin
2021-11-30 14:14 ` [PATCH 2/2] add -i: default to the built-in implementation Johannes Schindelin via GitGitGadget
2021-12-01 11:20   ` Phillip Wood [this message]
2021-12-02 15:01     ` Johannes Schindelin
2021-12-02 16:58       ` Junio C Hamano
2021-12-02 17:43         ` Ramsay Jones
2021-12-10 22:59         ` Johannes Schindelin
2021-12-01 13:37   ` Ævar Arnfjörð Bjarmason
2021-12-01 22:41     ` Junio C Hamano
2021-12-01 22:34   ` Junio C Hamano
2021-12-02 17:30     ` Johannes Schindelin
2021-12-09  4:12   ` [PATCH] fixup! " Junio C Hamano
2021-12-10 22:55     ` Johannes Schindelin
2021-11-30 20:56 ` [PATCH 0/2] Use the built-in implementation of the interactive add command by default Jeff King
2021-11-30 21:15 ` Junio C Hamano
2021-12-01 13:43 ` Ævar Arnfjörð Bjarmason
2021-12-01 21:24 ` Carlo Arenas
2021-12-02 17:33   ` Johannes Schindelin
2021-12-03 13:58 ` Philippe Blain
2021-12-06 15:59   ` Johannes Schindelin

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=a936a701-c13f-346e-69ee-85441ca20641@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=liu.denton@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=slawica92@hotmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).