summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-04-25 09:45:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-07 04:04:47 (GMT)
commit2f0896ec3ad4731d970d22f61daf62046bc766a9 (patch)
treeadea2c00ca3ed4a2704b97bbac131f7a22641636 /builtin
parenta5e5f399ca89cea574d11704d625a7b28b53de76 (diff)
downloadgit-2f0896ec3ad4731d970d22f61daf62046bc766a9.zip
git-2f0896ec3ad4731d970d22f61daf62046bc766a9.tar.gz
git-2f0896ec3ad4731d970d22f61daf62046bc766a9.tar.bz2
restore: support --patch
git-restore is different from git-checkout that it only restores the worktree by default, not both worktree and index. add--interactive needs some update to support this mode. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/checkout.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 824ab65..bed79ae 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -454,9 +454,11 @@ static int checkout_paths(const struct checkout_opts *opts,
patch_mode = "--patch=checkout";
else if (opts->checkout_index && !opts->checkout_worktree)
patch_mode = "--patch=reset";
+ else if (!opts->checkout_index && opts->checkout_worktree)
+ patch_mode = "--patch=worktree";
else
- die(_("'%s' with only '%s' is not currently supported"),
- "--patch", "--worktree");
+ BUG("either flag must have been set, worktree=%d, index=%d",
+ opts->checkout_worktree, opts->checkout_index);
return run_add_interactive(revision, patch_mode, &opts->pathspec);
}