mirror of
https://github.com/git/git.git
synced 2024-11-18 23:14:51 +01:00
6d297f8137
This is just an update for people being interested. Alex and me were busy with that project for a few days now. While it has progressed nicely, there are quite a couple TODOs in merge-recursive.c, just search for "TODO". For impatient people: yes, it passes all the tests, and yes, according to the evil test Alex did, it is faster than the Python script. But no, it is not yet finished. Biggest points are: - there are still three external calls - in the end, it should not be necessary to write the index more than once (just before exiting) - a lot of things can be refactored to make the code easier and shorter BTW we cannot just plug in git-merge-tree yet, because git-merge-tree does not handle renames at all. This patch is meant for testing, and as such, - it compile the program to git-merge-recur - it adjusts the scripts and tests to use git-merge-recur instead of git-merge-recursive - it provides "TEST", a script to execute the tests regarding -recursive - it inlines the changes to read-cache.c (read_cache_from(), discard_cache() and refresh_cache_entry()) Brought to you by Alex Riesen and Dscho Signed-off-by: Junio C Hamano <junkio@cox.net>
112 lines
2.2 KiB
Bash
Executable file
112 lines
2.2 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2006 Junio C Hamano
|
|
#
|
|
|
|
test_description='git rebase --merge test'
|
|
|
|
. ./test-lib.sh
|
|
|
|
if test "$no_python"; then
|
|
echo "Skipping: no python => no recursive merge"
|
|
test_done
|
|
exit 0
|
|
fi
|
|
|
|
T="A quick brown fox
|
|
jumps over the lazy dog."
|
|
for i in 1 2 3 4 5 6 7 8 9 10
|
|
do
|
|
echo "$i $T"
|
|
done >original
|
|
|
|
test_expect_success setup '
|
|
git add original &&
|
|
git commit -m"initial" &&
|
|
git branch side &&
|
|
echo "11 $T" >>original &&
|
|
git commit -a -m"master updates a bit." &&
|
|
|
|
echo "12 $T" >>original &&
|
|
git commit -a -m"master updates a bit more." &&
|
|
|
|
git checkout side &&
|
|
(echo "0 $T" ; cat original) >renamed &&
|
|
git add renamed &&
|
|
git update-index --force-remove original &&
|
|
git commit -a -m"side renames and edits." &&
|
|
|
|
tr "[a-z]" "[A-Z]" <original >newfile &&
|
|
git add newfile &&
|
|
git commit -a -m"side edits further." &&
|
|
|
|
tr "[a-m]" "[A-M]" <original >newfile &&
|
|
rm -f original &&
|
|
git commit -a -m"side edits once again." &&
|
|
|
|
git branch test-rebase side &&
|
|
git branch test-rebase-pick side &&
|
|
git branch test-reference-pick side &&
|
|
git checkout -b test-merge side
|
|
'
|
|
|
|
test_expect_success 'reference merge' '
|
|
git merge -s recur "reference merge" HEAD master
|
|
'
|
|
|
|
test_expect_success rebase '
|
|
git checkout test-rebase &&
|
|
git rebase --merge master
|
|
'
|
|
|
|
test_expect_success 'merge and rebase should match' '
|
|
git diff-tree -r test-rebase test-merge >difference &&
|
|
if test -s difference
|
|
then
|
|
cat difference
|
|
(exit 1)
|
|
else
|
|
echo happy
|
|
fi
|
|
'
|
|
|
|
test_expect_success 'rebase the other way' '
|
|
git reset --hard master &&
|
|
git rebase --merge side
|
|
'
|
|
|
|
test_expect_success 'merge and rebase should match' '
|
|
git diff-tree -r test-rebase test-merge >difference &&
|
|
if test -s difference
|
|
then
|
|
cat difference
|
|
(exit 1)
|
|
else
|
|
echo happy
|
|
fi
|
|
'
|
|
|
|
test_expect_success 'picking rebase' '
|
|
git reset --hard side &&
|
|
git rebase --merge --onto master side^^ &&
|
|
mb=$(git merge-base master HEAD) &&
|
|
if test "$mb" = "$(git rev-parse master)"
|
|
then
|
|
echo happy
|
|
else
|
|
git show-branch
|
|
(exit 1)
|
|
fi &&
|
|
f=$(git diff-tree --name-only HEAD^ HEAD) &&
|
|
g=$(git diff-tree --name-only HEAD^^ HEAD^) &&
|
|
case "$f,$g" in
|
|
newfile,newfile)
|
|
echo happy ;;
|
|
*)
|
|
echo "$f"
|
|
echo "$g"
|
|
(exit 1)
|
|
esac
|
|
'
|
|
|
|
test_done
|