On Mon, Dec 10, 2018 at 6:18 PM Elijah Newren <newren@xxxxxxxxx> wrote: > > The final step in the series is to actually make use of this in 'git > > stash', which simplifies the code there a bit. I am however happy to > > hold off on this step until the stash-in-C series is merged, so we > > don't delay that further. > > > > In addition to the no-overlay mode, we also add a --cached mode, which > > works only on the index, thus similar to 'git reset <tree-ish> -- <pathspec>'. > > If you're adding a --cached mode to make it only work on the index, > should there be a similar mode to allow it to only work on the working > tree? (I'm not as concerned with that here, but I really think the > new restore-files command by default should only operate on the > working tree, and then have options to affect the index either in > addition or instead of the working tree.) In the context of restore-files, --target=<worktree|index|both> is a very good candidate because "restore-files --from=foo --target=index" is almost like saying "restore files in the index from "foo"". For checkout, probably not as good. But then we can have different option names for the two commands. So if "git checkout" is going to never have "update worktree only" mode, then --cached is a still good way to go. -- Duy