On Tue, Apr 29, 2014 at 11:08:29PM -0500, Felipe Contreras wrote:
> If we use a different conflict style `git rerere forget` is not able to
> find the matching conflict SHA-1 because the diff generated is actually
> different from what `git merge` generated.
Can you show an example or test case?
I could not reproduce the problem with a trivial case, and rerere
specifically tries to handle the differences between "merge" and "diff3"
styles by throwing away the base content between "|" and "=" lines.
However, I wonder if it could still miss a match in some cases because
the "merge" style uses XDL_MERGE_ZEALOUS, whereas diff3 bumps it
down to XDL_MERGE_EAGER, which could lead to a slightly different
If so, I think this points to a slightly more pervasive problem in
"rerere", then: data recorded under one merge level might not be usable
later (whether for "rerere forget" or for actually applying a
The level can change if:
1. you have run something like "checkout --conflict=diff3" (and rerere
reads in the working tree file, which it does for regular
resolution, but not for "forget").
2. you use "git merge-file", which uses XDL_MERGE_ZEALOUS_ALNUM
3. you record resolutions and then change merge.conflictstyle
For (1), this is hopefully rarely going to be an issue, since "merge"
applies rerere itself before you get a chance to run checkout. So you
would have to manually run "git rerere" yourself (you might do that with
"rerere forget", but "forget" always re-runs the merge from the index).
For (2), we can hopefully ignore it, as merge-file does not run rerere
(and probably not many people use merge-file at all these days).
For (3), we can hopefully ignore this as rare; changing the variable
invalidates your cache, but only the hunks for which the ZEALOUS/EAGER
level makes a difference.
There isn't currently a way to tweak the merge-level manually, which
would be the other obvious way to trigger the situation.
We already get around the merge/diff3 format by trying to normalize the
merge/diff3 hunks we see. It would be nice if we could normalize away
the merge-levels, too, but I don't think that is possible just from the
conflict data. We'd have to actually re-run the low-level merge with
known settings. For git-merge, that would mean doubling the work when
"rerere" is in use. And it would mean that we could not run "rerere" on
a partially-resolved file.
So given all of the "hopefully rare" statements above and the complexity
of the complete solution, it's probably not worth pursuing. In which
case your patch seems like the best we can do. At least it covers the
more common case when you have set merge.conflictstyle but _didn't_
change it since the postimage was recorded.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html