From 8a0fc8d19dff0c0ed09ce6656e353daf06c21892 Mon Sep 17 00:00:00 2001 From: Joel Teichroeb Date: Mon, 25 Feb 2019 23:16:15 +0000 Subject: stash: convert apply to builtin Add a builtin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply lets conversion get started without the other commands being finished. The helper is being implemented as a drop in replacement for stash so that when it is complete it can simply be renamed and the shell script deleted. Delete the contents of the apply_stash shell function and replace it with a call to stash--helper apply until pop is also converted. Signed-off-by: Joel Teichroeb Signed-off-by: Paul-Sebastian Ungureanu Signed-off-by: Thomas Gummerer Signed-off-by: Junio C Hamano --- git.c | 1 + 1 file changed, 1 insertion(+) (limited to 'git.c') diff --git a/git.c b/git.c index 2f604a41ea..76ee02802e 100644 --- a/git.c +++ b/git.c @@ -554,6 +554,7 @@ static struct cmd_struct commands[] = { { "show-index", cmd_show_index }, { "show-ref", cmd_show_ref, RUN_SETUP }, { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE }, + { "stash--helper", cmd_stash__helper, RUN_SETUP | NEED_WORK_TREE }, { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE }, { "stripspace", cmd_stripspace }, { "submodule--helper", cmd_submodule__helper, RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT }, -- cgit v1.2.3 From 40af14683432285b94407e8488eab6942d0779dc Mon Sep 17 00:00:00 2001 From: Paul-Sebastian Ungureanu Date: Mon, 25 Feb 2019 23:16:28 +0000 Subject: stash: convert `stash--helper.c` into `stash.c` The old shell script `git-stash.sh` was removed and replaced entirely by `builtin/stash.c`. In order to do that, `create` and `push` were adapted to work without `stash.sh`. For example, before this commit, `git stash create` called `git stash--helper create --message "$*"`. If it called `git stash--helper create "$@"`, then some of these changes wouldn't have been necessary. This commit also removes the word `helper` since now stash is called directly and not by a shell script. Signed-off-by: Paul-Sebastian Ungureanu Signed-off-by: Thomas Gummerer Signed-off-by: Junio C Hamano --- git.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git.c') diff --git a/git.c b/git.c index 76ee02802e..49ab91b4ec 100644 --- a/git.c +++ b/git.c @@ -554,7 +554,7 @@ static struct cmd_struct commands[] = { { "show-index", cmd_show_index }, { "show-ref", cmd_show_ref, RUN_SETUP }, { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE }, - { "stash--helper", cmd_stash__helper, RUN_SETUP | NEED_WORK_TREE }, + { "stash", cmd_stash, RUN_SETUP | NEED_WORK_TREE }, { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE }, { "stripspace", cmd_stripspace }, { "submodule--helper", cmd_submodule__helper, RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT }, -- cgit v1.2.3 From 90a462725ef3932a2408e78a47e3dfc1b8d445cf Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 25 Feb 2019 23:16:30 +0000 Subject: stash: optionally use the scripted version again We recently converted the `git stash` command from Unix shell scripts to builtins. Let's end users a way out when they discover a bug in the builtin command: `stash.useBuiltin`. As the file name `git-stash` is already in use, let's rename the scripted backend to `git-legacy-stash`. To make the test suite pass with `stash.useBuiltin=false`, this commit also backports rudimentary support for `-q` (but only *just* enough to appease the test suite), and adds a super-ugly hack to force exit code 129 for `git stash -h`. Signed-off-by: Johannes Schindelin Signed-off-by: Thomas Gummerer Signed-off-by: Junio C Hamano --- git.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'git.c') diff --git a/git.c b/git.c index 49ab91b4ec..8de729c9e6 100644 --- a/git.c +++ b/git.c @@ -554,7 +554,12 @@ static struct cmd_struct commands[] = { { "show-index", cmd_show_index }, { "show-ref", cmd_show_ref, RUN_SETUP }, { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE }, - { "stash", cmd_stash, RUN_SETUP | NEED_WORK_TREE }, + /* + * NEEDSWORK: Until the builtin stash is thoroughly robust and no + * longer needs redirection to the stash shell script this is kept as + * is, then should be changed to RUN_SETUP | NEED_WORK_TREE + */ + { "stash", cmd_stash }, { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE }, { "stripspace", cmd_stripspace }, { "submodule--helper", cmd_submodule__helper, RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT }, -- cgit v1.2.3