Question about git-merge-stupid
- From
Miklos Vajna <vmiklos@frugalware.org>
- Date
- Jul 3, 2008, 12:33 UTC
- Message-ID
- <20080703123314.GS4729@genesis.frugalware.org>
Hi,
I'm trying to understand what is the difference between different merge strategies. git-merge-stupid is something I failed to understand from the git history/code/documentation, so I'm asking here.
1) From git history:
It seems git-merge-stupid was created by 2276aa6 when Junio renamed -resolve to -stupid and let -resolve use read-tree. Actually
git show 2276aa6:git-merge-stupid.sh
says -stupid uses read-tree as well.
2) From code:
It seems -stupid is better than -resolve when there are multiple bases. -resolve just passes all bases to read-tree, while -stupid tries to find the best one. It does it by counting unmerged entries and the less one is a better.
Here is what I tried:
A - B - C
X \
\ D - E - F(Where 'A' adds 'a.c' while the contents 'a', etc.)
$ git reset --hard e $ git merge -s resolve c Trying simple merge. Merge made by resolve.
So it seems resolve does not completely fail if there are multiple bases, either.
I would like to write a testcase that ensures git-merge-stupid really picks the best base, but I don't know exactly in what situation can the number of unmerged entires differ.
3) From documentation:
Actually -stupid is missing from Documentation/merge-strategies.txt. I plan to send a patch to add it, once I understnad what it does. :-)
Thanks.
[ Writing to Linus as suggested by Dscho, adding Junio to CC as - according to git log - both strategy created by him. ]