summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-06-21 10:56:41 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-06-21 10:56:41 (GMT)
commit160a59f326d55970f8a038ef635c662b9c648c75 (patch)
tree5b005f53099a7cf02ccf1b784548cce0c7d277c0 /t
parent9d24ed4f019e035eeb8125c2c595876ad1211a3a (diff)
parent693c15dc282c36042eac8d215beae3067db7565c (diff)
downloadgit-160a59f326d55970f8a038ef635c662b9c648c75.zip
git-160a59f326d55970f8a038ef635c662b9c648c75.tar.gz
git-160a59f326d55970f8a038ef635c662b9c648c75.tar.bz2
Merge branch 'ew/rebase' into next
* ew/rebase: rebase: error out for NO_PYTHON if they use recursive merge Add renaming-rebase test. rebase: Allow merge strategies to be used when rebasing object-refs: avoid division by zero
Diffstat (limited to 't')
-rwxr-xr-xt/t3402-rebase-merge.sh112
1 files changed, 112 insertions, 0 deletions
diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
new file mode 100755
index 0000000..d34c6cf
--- /dev/null
+++ b/t/t3402-rebase-merge.sh
@@ -0,0 +1,112 @@
+#!/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 recursive "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