git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 9/9] rerere forget path: forget recorded resolution

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 11, 2010, 20:05 UTC
Message-ID
<7v3a2cif04.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201001112022.31257.j6t@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 6 quoted lines
> I did encounter a case where the same resolution would apply to all
> conflicts that have the same conflict hash, so it's not quite what you
> talk about. But not all conflicts were automatically resolved. I haven't
> yet analyzed what happened - it could just be that the xdl_merge call
> fails due to the differences in the text immediately outside the
> conflict markers.

Actually it is _very_ easy to fool rerere to do something totally unexpected, and I have been thinking about using the similarity comparison algorithm on the region outside the conflicted area between preimage and thisimage and reject use of rerere.

Try this in an empty directory.
-- >8 --
#!/bin/sh
git init
create_numbers () {
	for n in 0 1 2 3 4 "$1" 5 6 7 8 9
	do
		echo $n
	done >numbers.txt
}
create_letters () {
	for l in a b c d e "$1" f g h i j
	do
		echo $l
	done >letters.txt
}
create_files () {
	create_numbers "$1"
	create_letters "$1"
}

create_files "" git add numbers.txt letters.txt git commit -m initial git branch side

create_files "+" git commit -a -m master

git checkout side create_files "-" git commit -a -m side

mkdir -p .git/rr-cache

# On this history we changed an empty line to +; merge # with another history that changed it to - git checkout master^0 git merge side

# The above should have conflicted.  The resolution is to '='

create_numbers "=" git rerere

git rerere status git rerere diff cat numbers.txt cat letters.txt

-- 8< --
Now, immediately after this sequence, rerere will give you an disaster.
Previous: Johannes SixtNext: Johannes Sixt
Message 20 of 21 in “Undoing conflict resolution”
  1. 0/9 Undoing conflict resolutionJunio C Hamano, Dec 29, 2009
  2. 1/9 builtin-merge.c: use standard active_cache macrosJunio C Hamano, Dec 29, 2009
  3. 2/9 resolve-undo: record resolved conflicts in a new index extension sectionJunio C Hamano, Dec 29, 2009
  4. 3/9 resolve-undo: basic testsJunio C Hamano, Dec 29, 2009
  5. 4/9 resolve-undo: allow plumbing to clear the informationJunio C Hamano, Dec 29, 2009
  6. 5/9 resolve-undo: "checkout -m path" uses resolve-undo informationJunio C Hamano, Dec 29, 2009
  7. 6/9 resolve-undo: teach "update-index --unresolve" to use resolve-undo infoJunio C Hamano, Dec 29, 2009
  8. 7/9 rerere: remove silly 1024-byte line limitJunio C Hamano, Dec 29, 2009
  9. 8/9 rerere: refactor rerere logic to make it independent from I/OJunio C Hamano, Dec 29, 2009
  10. 9/9 rerere forget path: forget recorded resolutionJunio C Hamano, Dec 29, 2009
  11. Johannes SixtJan 5, 2010
  12. Junio C HamanoJan 6, 2010
  13. Johannes SixtJan 6, 2010
  14. Junio C HamanoJan 6, 2010
  15. Junio C HamanoJan 6, 2010
  16. Johannes SixtJan 8, 2010
  17. Junio C HamanoJan 8, 2010
  18. Junio C HamanoJan 11, 2010
  19. Johannes SixtJan 11, 2010
  20. Junio C HamanoJan 11, 2010
  21. Johannes SixtJan 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.