Re: Command-line interface thoughts
- From
Jeff King <peff@peff.net>
- Date
- Jun 9, 2011, 19:41 UTC
- Message-ID
- <20110609194104.GA4026@sigill.intra.peff.net>
- In-Reply-To
- <4DF10ADA.5070206@alum.mit.edu>
On Thu, Jun 09, 2011 at 08:03:06PM +0200, Michael Haggerty wrote:
Show 5 quoted lines
> Thanks for the correction. So one interesting pseudo-tree would be > > OURS -- The NEXT version of any file that has been resolved; and the > stage 2 version of any file that has not yet been resolved. The name > seems consistent with what is meant by, e.g., "git checkout --ours".
Yeah, that makes sense to me as a definition.
Show 5 quoted lines
> > So the index is not quite simply a set of four trees. The presence of > > various stages for each entry tells us the progress of resolution. > > Wouldn't the four trees described above contain information equivalent > to the contents of the index?
Taken together, yes, I think you could represent the whole index. But each taken alone is missing some information that might be useful in a diff.
For example, if I do "git diff THEIRS WTREE" during a merge conflict, that is a 2-way diff that is going to show things in THEIRS going away, and both things brought by OURS and things that are part of a resolution being added. That's less information than "git diff INDEX WTREE" (i.e., what is currently spelled as "git diff") provides, because when looking at the whole index we can do a combined diff showing which part came from which parent.
Show 6 quoted lines
> For example, the resolution work that remains to be done that can be > inquired using old-fashioned "git diff" (3-way diff) could also be > accessed via > > git diff NEXT OURS > git diff NEXT THEIRS
But you don't get to see it together. You have to do two separate diffs, which means you will see conflicted regions twice. Try:
git log --merges -p --cc
on a repo of your choice, and compare with:
git log --merges -p -m
The former is what "git diff" would show just before marking paths as resolved, and the latter is what your two diffs above would show.
Show 5 quoted lines
> or even > > git diff NEXT WTREE > > if you want to see the remaining conflicts in <<<<<======>>>>>> format.
As I mentioned in an earlier email, this doesn't show which parts are part of the resolution process (including conflict markers), and which came from either side of the merge.
-Peff