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

Re: [PATCH] merge-tree: sometimes, d/f conflict is not an issue

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 8, 2007, 13:16 UTC
Message-ID
<Pine.LNX.4.64.0707081353560.4248@racer.site>
In-Reply-To
<7vwsxb4e2q.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sat, 7 Jul 2007, Junio C Hamano wrote:
Show 7 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > The last time I looked at merge-recursive's D/F check, I found that it 
> > was not quite doing things right.  I may be able to dig up what I 
> > posted to the list...
> 
> It was from around April 7th-10th this year.

Unfortunately, this is way over my time budget. As well as over my intelligence budget, since I did not even succeed in understanding the code in threeway_merge _at all_.

Besides, IMHO there is a deeper issue. Since merge-recursive started out as a Python script, and grew there until it was usable, and grew the rename detection therein, too, until it was finally converted to C, it accumulated a lot of features that would have been nice to have independently.

Almost the same goes for unpack-trees, which (its name to the contrary) does quite a few things to merge entries, too. And it tries to detect d/f conflicts, too.

So there we are, with two really big and unwieldy chunks of code, each deserving an own GSoC project to clean them up. Or maybe not even a GSoC project, but a longer project.

What I would _like_ to see is something as clean as merge-tree. Which is clearly separated (code and file wise, too) into these stages:

- reading the trees
- determining renames
- determining true d/f conflicts
- threeway merge
- writing the tree object
- writing the work tree
- recursive
Ideally, merge-recursive would really have been as simple as
	case "$1" in
	--index_only)
		index_only=$1
		shift
	esac
	a="$1"
	b="$2"
	set $(git merge-base --all $a $b)
	temp=$1
	shift
	while case $# in 0) break;; esac
	do
		temp=$(git merge-recursive --index-only $temp $1)
		shift
	done
	git merge-non-recursive $index_only $temp -- "$a" "$b"

because _read-tree -m_ should have learnt about renames, _not_ merge-recursive.

As it is, both unpack_trees() and merge-recursive have a certain degree of not-quite duplicated yet wants-to-do-largely-the-same functionality. Which of course leads to much finger pointing: "it's unpack_trees() fault. no. it's merge-recursive's fault. no, vice versa."

Maybe the proper way out is really to start from merge-tree.c and do something which is easy to understand, and concise, and thus has a much lesser chance of being buggy.

Ciao, Dscho

Previous: Junio C HamanoNext: Junio C Hamano
Message 17 of 23 in “unexpected git-cherry-pick conflict”
  1. Gerrit PapeJun 13, 2007
  2. Johannes SchindelinJun 13, 2007
  3. Gerrit PapeJun 13, 2007
  4. Johannes SchindelinJun 13, 2007
  5. Gerrit PapeJun 25, 2007
  6. Johannes SchindelinJun 25, 2007
  7. Johannes SchindelinJul 7, 2007
  8. Gerrit PapeDec 21, 2007
  9. Junio C HamanoDec 22, 2007
  10. merge-tree: sometimes, d/f conflict is not an issueJohannes Schindelin, Jul 8, 2007
  11. Junio C HamanoJul 8, 2007
  12. Johannes SchindelinJul 8, 2007
  13. Johannes SchindelinJul 8, 2007
  14. Johannes SchindelinJul 8, 2007
  15. Junio C HamanoJul 8, 2007
  16. Junio C HamanoJul 8, 2007
  17. Johannes SchindelinJul 8, 2007
  18. Junio C HamanoJul 8, 2007
  19. merge-one-file, was Re: [PATCH] merge-tree: sometimes, d/f conflict is not an issueJohannes Schindelin, Jul 9, 2007
  20. 1/2 merge-recursive: sometimes, d/f conflict is not an issueJohannes Schindelin, Jul 17, 2007
  21. Gerrit PapeAug 8, 2007
  22. 2/2 Add tests for cherry-pick d/f conflict which should be noneJohannes Schindelin, Jul 17, 2007
  23. Johannes SchindelinJul 8, 2007

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.