restore: support --patch
[gitweb.git] / builtin / checkout.c
index 824ab65886c0f5778be250331174ee13b1c67b6f..bed79ae595cb84cf810fd0c247025226b76fbb54 100644 (file)
@@ -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);
        }