Re: [PATCH] combine-diff: coalesce lost lines optimally
- From
Antoine Pelisse <apelisse@gmail.com>
- Date
- Mar 17, 2013, 13:58 UTC
- Message-ID
- <CALWbr2xWYiFULLDVA7b9WrVtmfdAvZC9SKBHjZE9aRc6kfRMGA@mail.gmail.com>
- In-Reply-To
- <1363525436-21667-1-git-send-email-apelisse@gmail.com>
> I'm also having a hard time trying it with more than two parents. How I > am supposed to have more than two parents while octopus merge refuses if > there are conflicts ?
OK, creating the merge commit myself solves the issue:
git init
>test
git add test git commit -m initial
seq 100 >test git commit -m all -a
git checkout -b side1 HEAD^1 seq 1 2 100 >test git commit -m side1 -a
git checkout -b side2 HEAD^1 seq 1 4 100 >test git commit -m side2 -a
git checkout -b side3 HEAD^1 seq 1 8 100 >test git commit -m side3 -a
git checkout -b side4 HEAD^1 seq 1 16 100 >test git commit -m side4 -a
git checkout master
>test
git add test TREE=$(git write-tree) COMMIT=$(git commit-tree $TREE -p master -p side1 -p side2 -p side3 -p side4 -m merge) git show $COMMIT
This will work with the basic greedy implementation if all parents are in this order. But the optimal result will be lost if we change the order of -p parameters in git-commit-tree. The patch seems to be correct, always finding the best result (we always have 100 lines diff) whatever the order of parents.