Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I audit git rerere's resolutions?

Background

I am currently resolving a merge conflict with git rerere enabled. git status shows one unmerged path. When I view the file, there are no <<<<<<< HEAD or >>>>>>> <SHA> markers identifying the conflict, which tells me that rerere has done it's work and resolved the conflict according to how I have done it in the past.

I would like to confirm that rerere's resolutions are correct.

The merge process I am working on is very complex involving multiple remotes contributing to the Linux kernel. I did a test merge of several remotes yesterday with the goal of identifying conflicts, notifying maintainers, then discarding the resulting (surely broken) kernel. While doing so, I made a couple of careless conflict resolutions just to move on to the next remote, and called git rerere forget <pathspec> on all of the conflicting paths after I was done, including the one I'm dealing with now. Since I told rerere to forget this path, I don't know why it resolved anything on this run, and I'm concerned that it applied the fix that I made yesterday when I didn't care if the result was correct.

The Question

Is there any way to see what conflicts rerere resolved after it has already applied the resolution?

I would like to avoid restarting the merge because it's a long process that we don't have fully automated yet. Also, since I tried to tell rerere to forget this path yesterday and yet it still applied a resolution today, I think I would just end up in the same position if I don't find out why git rerere forget <pathspec> failed first.

Related Questions
Undo a git rerere resolution that was done in a rebase <-- solution requires restarting merge
Are there any downsides to enabling git rerere? <-- only discusses git rerere forget <pathspec>

Follow Up Note/Question
I just tried entering git rerere forget with no pathspec, which I'm aware is deprecated, but if I understand correctly, should make rerere forget all resolutions. I reran the merge and it still applied a resolution to the file. I also completely disabled rerere and ran the merge a third time so I could see the conflict, and rerere was indeed applying the half-hearted resolutions I did yesterday. Why is forget not correctly discarding resolution that I don't want to reuse?

like image 200
skrrgwasme Avatar asked Jun 17 '16 18:06

skrrgwasme


1 Answers

you can switch to the un-rerere'd merge result with

git checkout -m path/to/file

and then reapply it with

git rerere

Regarding the forget troubles, did you do the forget while the conflict was still active? Forget applies to "the current conflict in <pathspec>"

$ git checkout master^1
Warning: you are leaving 1 commit behind, not connected to
any of your branches:


  9e2db79 test3

HEAD is now at ca1fca7... Make a change to file (on master)
$ git merge master^2
Auto-merging file.txt
CONFLICT (content): Merge conflict in file.txt
Resolved 'file.txt' using previous resolution.
Automatic merge failed; fix conflicts and then commit the result.
$ git rerere forget file.txt
Updated preimage for 'file.txt'
Forgot resolution for file.txt
$ vi file.txt                     # old resolution's still in the worktree
$ git checkout -m file.txt        # now it's gone there too
like image 81
jthill Avatar answered Sep 24 '22 09:09

jthill