Re: [BUG?] git checkout $commit -- somedir doesn't drop files
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 17, 2013, 22:14 UTC
- Message-ID
- <xmqqd2o7w0xc.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20130917220345.GA22914@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> On Tue, Sep 17, 2013 at 03:00:41PM -0700, Junio C Hamano wrote: > >> > So given that, is it fair to say that a one-way "go here" merge, limited >> > by pathspec, is the closest equivalent? >> >> Sorry, but it is unclear to me what you mean by one-way "go here" >> merge. Do you mean oneway_merge() in unpack-trees.c? > > Yes, that is what I meant.
Yeah, then I agree that "git checkout HEAD^ -- subdir" should be a one-way "go HEAD^" merge limited only to the paths that match subdir/.
If implemented in a straight-forward way, I suspect that we may end up not removing subdir/b in Uwe's sample transcript. I am not sure if that is a good thing or not, though. If the index originally tracked and then "going to" tree does not, I think removing it would match "ignore local modifications" rule, as subdir/a that is tracked in the index and also in "going to" tree does get overwritten to match the state recorded in the tree.