Skip to content

Commit 369ae75

Browse files
committed
Merge branch 'tg/retire-scripted-stash'
"git stash" has kept an escape hatch to use the scripted version for a few releases, which got stale. It has been removed. * tg/retire-scripted-stash: stash: remove the stash.useBuiltin setting stash: get git_stash_config at the top level
2 parents 0f0625a + 8a2cd3f commit 369ae75

File tree

8 files changed

+31
-862
lines changed

8 files changed

+31
-862
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: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ static int list_stash(int argc, const char **argv, const char *prefix)
702702

703703
static int show_stat = 1;
704704
static int show_patch;
705+
static int use_legacy_stash;
705706

706707
static int git_stash_config(const char *var, const char *value, void *cb)
707708
{
@@ -713,7 +714,11 @@ static int git_stash_config(const char *var, const char *value, void *cb)
713714
show_patch = git_config_bool(var, value);
714715
return 0;
715716
}
716-
return git_default_config(var, value, cb);
717+
if (!strcmp(var, "stash.usebuiltin")) {
718+
use_legacy_stash = !git_config_bool(var, value);
719+
return 0;
720+
}
721+
return git_diff_basic_config(var, value, cb);
717722
}
718723

719724
static int show_stash(int argc, const char **argv, const char *prefix)
@@ -750,7 +755,6 @@ static int show_stash(int argc, const char **argv, const char *prefix)
750755
* any options.
751756
*/
752757
if (revision_args.argc == 1) {
753-
git_config(git_stash_config, NULL);
754758
if (show_stat)
755759
rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT;
756760

@@ -1559,29 +1563,6 @@ static int save_stash(int argc, const char **argv, const char *prefix)
15591563
return ret;
15601564
}
15611565

1562-
static int use_builtin_stash(void)
1563-
{
1564-
struct child_process cp = CHILD_PROCESS_INIT;
1565-
struct strbuf out = STRBUF_INIT;
1566-
int ret, env = git_env_bool("GIT_TEST_STASH_USE_BUILTIN", -1);
1567-
1568-
if (env != -1)
1569-
return env;
1570-
1571-
argv_array_pushl(&cp.args,
1572-
"config", "--bool", "stash.usebuiltin", NULL);
1573-
cp.git_cmd = 1;
1574-
if (capture_command(&cp, &out, 6)) {
1575-
strbuf_release(&out);
1576-
return 1;
1577-
}
1578-
1579-
strbuf_trim(&out);
1580-
ret = !strcmp("true", out.buf);
1581-
strbuf_release(&out);
1582-
return ret;
1583-
}
1584-
15851566
int cmd_stash(int argc, const char **argv, const char *prefix)
15861567
{
15871568
pid_t pid = getpid();
@@ -1592,21 +1573,12 @@ int cmd_stash(int argc, const char **argv, const char *prefix)
15921573
OPT_END()
15931574
};
15941575

1595-
if (!use_builtin_stash()) {
1596-
const char *path = mkpath("%s/git-legacy-stash",
1597-
git_exec_path());
1598-
1599-
if (sane_execvp(path, (char **)argv) < 0)
1600-
die_errno(_("could not exec %s"), path);
1601-
else
1602-
BUG("sane_execvp() returned???");
1603-
}
1604-
1605-
prefix = setup_git_directory();
1606-
trace_repo_setup(prefix);
1607-
setup_work_tree();
1576+
git_config(git_stash_config, NULL);
16081577

1609-
git_config(git_diff_basic_config, NULL);
1578+
if (use_legacy_stash ||
1579+
!git_env_bool("GIT_TEST_STASH_USE_BUILTIN", -1))
1580+
warning(_("the stash.useBuiltin support has been removed!\n"
1581+
"See its entry in 'git help config' for details."));
16101582

16111583
argc = parse_options(argc, argv, prefix, options, git_stash_usage,
16121584
PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH);

0 commit comments

Comments
 (0)