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>
This commit is contained in:

committed by
Junio C Hamano

parent
a5e5f399ca
commit
2f0896ec3a
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user