Skip to content

Commit 8a2cd3f

Browse files
tgummerergitster
authored andcommitted
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 d03ebd4 ("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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b0c7362 commit 8a2cd3f

File tree

8 files changed

+30
-860
lines changed

8 files changed

+30
-860
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
/git-init-db
8484
/git-interpret-trailers
8585
/git-instaweb
86-
/git-legacy-stash
8786
/git-log
8887
/git-ls-files
8988
/git-ls-remote

Documentation/config/stash.txt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
stash.useBuiltin::
2-
Set to `false` to use the legacy shell script implementation of
3-
linkgit:git-stash[1]. Is `true` by default, which means use
4-
the built-in rewrite of it in C.
5-
+
6-
The C rewrite is first included with Git version 2.22 (and Git for Windows
7-
version 2.19). This option serves as an escape hatch to re-enable the
8-
legacy version in case any bugs are found in the rewrite. This option and
9-
the shell script version of linkgit:git-stash[1] will be removed in some
10-
future release.
11-
+
12-
If you find some reason to set this option to `false`, other than
13-
one-off testing, you should report the behavior difference as a bug in
14-
Git (see https://git-scm.com/community for details).
2+
Unused configuration variable. Used in Git versions 2.22 to
3+
2.26 as an escape hatch to enable the legacy shellscript
4+
implementation of stash. Now the built-in rewrite of it in C
5+
is always used. Setting this will emit a warning, to alert any
6+
remaining users that setting this now does nothing.
157

168
stash.showPatch::
179
If this is set to true, the `git stash show` command without an

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,6 @@ SCRIPT_SH += git-merge-one-file.sh
609609
SCRIPT_SH += git-merge-resolve.sh
610610
SCRIPT_SH += git-mergetool.sh
611611
SCRIPT_SH += git-quiltimport.sh
612-
SCRIPT_SH += git-legacy-stash.sh
613612
SCRIPT_SH += git-request-pull.sh
614613
SCRIPT_SH += git-submodule.sh
615614
SCRIPT_SH += git-web--browse.sh

builtin/stash.c

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ static int list_stash(int argc, const char **argv, const char *prefix)
701701

702702
static int show_stat = 1;
703703
static int show_patch;
704+
static int use_legacy_stash;
704705

705706
static int git_stash_config(const char *var, const char *value, void *cb)
706707
{
@@ -712,6 +713,10 @@ static int git_stash_config(const char *var, const char *value, void *cb)
712713
show_patch = git_config_bool(var, value);
713714
return 0;
714715
}
716+
if (!strcmp(var, "stash.usebuiltin")) {
717+
use_legacy_stash = !git_config_bool(var, value);
718+
return 0;
719+
}
715720
return git_diff_basic_config(var, value, cb);
716721
}
717722

@@ -1524,29 +1529,6 @@ static int save_stash(int argc, const char **argv, const char *prefix)
15241529
return ret;
15251530
}
15261531

1527-
static int use_builtin_stash(void)
1528-
{
1529-
struct child_process cp = CHILD_PROCESS_INIT;
1530-
struct strbuf out = STRBUF_INIT;
1531-
int ret, env = git_env_bool("GIT_TEST_STASH_USE_BUILTIN", -1);
1532-
1533-
if (env != -1)
1534-
return env;
1535-
1536-
argv_array_pushl(&cp.args,
1537-
"config", "--bool", "stash.usebuiltin", NULL);
1538-
cp.git_cmd = 1;
1539-
if (capture_command(&cp, &out, 6)) {
1540-
strbuf_release(&out);
1541-
return 1;
1542-
}
1543-
1544-
strbuf_trim(&out);
1545-
ret = !strcmp("true", out.buf);
1546-
strbuf_release(&out);
1547-
return ret;
1548-
}
1549-
15501532
int cmd_stash(int argc, const char **argv, const char *prefix)
15511533
{
15521534
int i = -1;
@@ -1558,22 +1540,13 @@ int cmd_stash(int argc, const char **argv, const char *prefix)
15581540
OPT_END()
15591541
};
15601542

1561-
if (!use_builtin_stash()) {
1562-
const char *path = mkpath("%s/git-legacy-stash",
1563-
git_exec_path());
1564-
1565-
if (sane_execvp(path, (char **)argv) < 0)
1566-
die_errno(_("could not exec %s"), path);
1567-
else
1568-
BUG("sane_execvp() returned???");
1569-
}
1570-
1571-
prefix = setup_git_directory();
1572-
trace_repo_setup(prefix);
1573-
setup_work_tree();
1574-
15751543
git_config(git_stash_config, NULL);
15761544

1545+
if (use_legacy_stash ||
1546+
!git_env_bool("GIT_TEST_STASH_USE_BUILTIN", -1))
1547+
warning(_("the stash.useBuiltin support has been removed!\n"
1548+
"See its entry in 'git help config' for details."));
1549+
15771550
argc = parse_options(argc, argv, prefix, options, git_stash_usage,
15781551
PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH);
15791552

0 commit comments

Comments
 (0)