Jeff King [off-list ref] writes:
One more wishlist item for this. I use "add -p" for almost all of my
adds these days, because I like the final review check. So after a
conflicted merge, I find myself doing "add -p" to stage my resolution.
The current behavior is that it shows the --cc diff and exits. It would
be cool to handle staging the resolution, which would involve converting
the combined diff into something that can be applied.
I think the end-result would be a nice feature. I suspect that it would
not involve conversion from --cc, but more like using the difference
between the HEAD and the working tree, generated as if there is no
multi-stage index.
On Thu, Mar 10, 2011 at 11:21:47AM -0800, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
One more wishlist item for this. I use "add -p" for almost all of my
adds these days, because I like the final review check. So after a
conflicted merge, I find myself doing "add -p" to stage my resolution.
The current behavior is that it shows the --cc diff and exits. It would
be cool to handle staging the resolution, which would involve converting
the combined diff into something that can be applied.
I think the end-result would be a nice feature. I suspect that it would
not involve conversion from --cc, but more like using the difference
between the HEAD and the working tree, generated as if there is no
multi-stage index.
The trouble is that I would like to see the combined diff, then say "OK"
and have it apply the result to the index. But because we work on a
per-hunk basis, you need to match the combined diff hunks to the regular
diff hunks, taking into account that hunks could be split. Which maybe
is straightforward, but I haven't convinced myself yet that there are no
corner cases where they don't line up.
I guess one could argue that I should be using mergetool, and making a
mergetool helper that is more like "add -p" (show hunks, say "choose
left, choose right, choose none"). But I generally fix up the conflict
using an editor and just want "add -p" as a final check.
I'll probably look into it more eventually, but it's not a high priority
at this point.
-Peff