diff options
author | Thomas Gummerer <t.gummerer@gmail.com> | 2020-03-03 17:46:13 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-03-05 12:50:28 -0800 |
commit | 8a2cd3f5123ac822fd64ca8efc4f84e122a1edb3 (patch) | |
tree | d76ddb3ec284195b4e62814f5346ddfc732d116e /builtin/stash.c | |
parent | b0c7362d19a83d45798085f26d98e39c9268e7e5 (diff) | |
download | git-8a2cd3f5123ac822fd64ca8efc4f84e122a1edb3.tar.gz |
stash: remove the stash.useBuiltin setting
Remove the stash.useBuiltin setting which was added as an escape hatch
to disable the builtin version of stash first released with Git 2.22.
Carrying the legacy version is a maintenance burden, and has in fact
become out of date failing a test since the 2.23 release, without
anyone noticing until now. So users would be getting a hint to fall
back to a potentially buggy version of the tool.
We used to shell out to git config to get the useBuiltin configuration
to avoid changing any global state before spawning legacy-stash.
However that is no longer necessary, so just use the 'git_config'
function to get the setting instead.
Similar to what we've done in d03ebd411c ("rebase: remove the
rebase.useBuiltin setting", 2019-03-18), where we remove the
corresponding setting for rebase, we leave the documentation in place,
so people can refer back to it when searching for it online, and so we
can refer to it in the commit message.
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/stash.c')
-rw-r--r-- | builtin/stash.c | 47 |
1 files changed, 10 insertions, 37 deletions
diff --git a/builtin/stash.c b/builtin/stash.c index f371db270c..ba908a6834 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -701,6 +701,7 @@ static int list_stash(int argc, const char **argv, const char *prefix) static int show_stat = 1; static int show_patch; +static int use_legacy_stash; static int git_stash_config(const char *var, const char *value, void *cb) { @@ -712,6 +713,10 @@ static int git_stash_config(const char *var, const char *value, void *cb) show_patch = git_config_bool(var, value); return 0; } + if (!strcmp(var, "stash.usebuiltin")) { + use_legacy_stash = !git_config_bool(var, value); + return 0; + } return git_diff_basic_config(var, value, cb); } @@ -1524,29 +1529,6 @@ static int save_stash(int argc, const char **argv, const char *prefix) return ret; } -static int use_builtin_stash(void) -{ - struct child_process cp = CHILD_PROCESS_INIT; - struct strbuf out = STRBUF_INIT; - int ret, env = git_env_bool("GIT_TEST_STASH_USE_BUILTIN", -1); - - if (env != -1) - return env; - - argv_array_pushl(&cp.args, - "config", "--bool", "stash.usebuiltin", NULL); - cp.git_cmd = 1; - if (capture_command(&cp, &out, 6)) { - strbuf_release(&out); - return 1; - } - - strbuf_trim(&out); - ret = !strcmp("true", out.buf); - strbuf_release(&out); - return ret; -} - int cmd_stash(int argc, const char **argv, const char *prefix) { int i = -1; @@ -1558,22 +1540,13 @@ int cmd_stash(int argc, const char **argv, const char *prefix) OPT_END() }; - if (!use_builtin_stash()) { - const char *path = mkpath("%s/git-legacy-stash", - git_exec_path()); - - if (sane_execvp(path, (char **)argv) < 0) - die_errno(_("could not exec %s"), path); - else - BUG("sane_execvp() returned???"); - } - - prefix = setup_git_directory(); - trace_repo_setup(prefix); - setup_work_tree(); - git_config(git_stash_config, NULL); + if (use_legacy_stash || + !git_env_bool("GIT_TEST_STASH_USE_BUILTIN", -1)) + warning(_("the stash.useBuiltin support has been removed!\n" + "See its entry in 'git help config' for details.")); + argc = parse_options(argc, argv, prefix, options, git_stash_usage, PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH); |