On Tue, Mar 21, 2017 at 09:14:24PM +0000, Thomas Gummerer wrote: > > I don't think read-tree takes pathspecs, so it would have to drop the > > "-u" and replace it with checkout-index. I'm confused about why we would > > need it in the first place, though. We should have already dealt with > > the working tree files in the earlier block, so there should be nothing > > to checkout. > > > > The "-u" goes all the way back to 7bedebcaa (stash: introduce 'stash > > save --keep-index' option, 2008-06-27). I wonder if it has always been > > unnecessary, but we never noticed because it's just a noop. > > I do think the "-u" is necessary. Say we have a repository with > changes in 'foo' and 'bar', where the changes in bar are added to the > index. > > Then 'git stash -k' would wipe out the changes in both 'foo' and 'bar' > through 'git reset --hard', but we do want the changes in 'bar' to > still exist on disk, which they wouldn't without the "-u". Yeah, you're right. It makes me wonder if the "-k" case should be skipping the "reset --hard". But as this series has shown, this procedure is sufficiently tricky that it may be a good idea to make the minimal change. > But I'll replace the "-u" with checkout-index, so we can respect the > pathspec. That makes sense. -Peff