Web lists-archives.com

Re: [PATCH v1 08/11] restore: support --patch




On Fri, Mar 8, 2019 at 2:17 AM Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> 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...  :-)

> @@ -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?