Re: [PATCH v1 08/11] restore: support --patch
- From
Elijah Newren <newren@gmail.com>
- Date
- Mar 9, 2019, 19:02 UTC
- Message-ID
- <CABPp-BGg6k_=zjZ+vCGzh2hu5KnXf3=OMDGJ=eei0xmxh6trAQ@mail.gmail.com>
- In-Reply-To
- <20190308101655.9767-9-pclouds@gmail.com>
On Fri, Mar 8, 2019 at 2:17 AM Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> > 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.
Nice! That removes my frowny face from a few patches before... :-)
Show 10 quoted lines
> @@ -436,9 +436,10 @@ 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");Very minor nit: I suspect we'll never hit this, but do we want to make the error message slightly more descriptive ("which flags"?) in case someone doing refactoring work does?