summaryrefslogtreecommitdiff
path: root/builtin/add.c
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2019-12-21 21:57:11 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-12-21 16:06:21 -0800
commit36bae1dc0ee777aa529dd955f2e619281265f262 (patch)
tree07a56e06c48b599b948e235ca0cd626232dc193e /builtin/add.c
parentbuilt-in add -p: prepare for patch modes other than "stage" (diff)
downloadtgif-36bae1dc0ee777aa529dd955f2e619281265f262.tar.xz
built-in add -p: implement the "stash" and "reset" patch modes
The `git stash` and `git reset` commands support a `--patch` option, and both simply hand off to `git add -p` to perform that work. Let's teach the built-in version of that command to be able to perform that work, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 006016267e..b0d6891479 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -201,6 +201,10 @@ int run_add_interactive(const char *revision, const char *patch_mode,
if (!strcmp(patch_mode, "--patch"))
mode = ADD_P_ADD;
+ else if (!strcmp(patch_mode, "--patch=stash"))
+ mode = ADD_P_STASH;
+ else if (!strcmp(patch_mode, "--patch=reset"))
+ mode = ADD_P_RESET;
else
die("'%s' not yet supported in the built-in add -p",
patch_mode);