* [PATCH 1/4] git-merge: Exit with code 2 if no strategy was able to handle the merge.
2005-12-03 10:32 [PATCH 0/4] Merge test cases Fredrik Kuivinen
@ 2005-12-03 10:40 ` Fredrik Kuivinen
2005-12-03 10:40 ` [PATCH 2/4] test-lib.sh: Add new function, test_expect_code Fredrik Kuivinen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Fredrik Kuivinen @ 2005-12-03 10:40 UTC (permalink / raw)
To: junkio; +Cc: git
This way it is possible to test in scripts if the merge was non-clean
or if the strategy had other problems with the merge.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-merge.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
8fb7e4ef2b13f85966976c567cefb6a6d4c18c29
diff --git a/git-merge.sh b/git-merge.sh
index d352a3c..a221daa 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -273,7 +273,8 @@ fi
case "$best_strategy" in
'')
restorestate
- die "No merge strategy handled the merge."
+ echo >&2 "No merge strategy handled the merge."
+ exit 2
;;
"$wt_strategy")
# We already have its result in the working tree.
--
0.99.9.GIT
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/4] test-lib.sh: Add new function, test_expect_code
2005-12-03 10:32 [PATCH 0/4] Merge test cases Fredrik Kuivinen
2005-12-03 10:40 ` [PATCH 1/4] git-merge: Exit with code 2 if no strategy was able to handle the merge Fredrik Kuivinen
@ 2005-12-03 10:40 ` Fredrik Kuivinen
2005-12-03 10:41 ` [PATCH 3/4] New test case: merge with directory/file conflicts Fredrik Kuivinen
2005-12-03 10:41 ` [PATCH 4/4] New test case: Criss-cross merge Fredrik Kuivinen
3 siblings, 0 replies; 5+ messages in thread
From: Fredrik Kuivinen @ 2005-12-03 10:40 UTC (permalink / raw)
To: junkio; +Cc: git
The test is considered OK if it exits with code $1
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
t/test-lib.sh | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
12ea56dda039b8b2fed61459a7a2df5ebf3dfde2
diff --git a/t/test-lib.sh b/t/test-lib.sh
index e654155..f2eccd7 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -133,6 +133,19 @@ test_expect_success () {
fi
}
+test_expect_code () {
+ test "$#" = 3 ||
+ error "bug in the test script: not 3 parameters to test-expect-code"
+ say >&3 "expecting exit code $1: $3"
+ test_run_ "$3"
+ if [ "$?" = 0 -a "$eval_ret" = "$1" ]
+ then
+ test_ok_ "$2"
+ else
+ test_failure_ "$@"
+ fi
+}
+
test_done () {
trap - exit
case "$test_failure" in
--
0.99.9.GIT
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] New test case: merge with directory/file conflicts
2005-12-03 10:32 [PATCH 0/4] Merge test cases Fredrik Kuivinen
2005-12-03 10:40 ` [PATCH 1/4] git-merge: Exit with code 2 if no strategy was able to handle the merge Fredrik Kuivinen
2005-12-03 10:40 ` [PATCH 2/4] test-lib.sh: Add new function, test_expect_code Fredrik Kuivinen
@ 2005-12-03 10:41 ` Fredrik Kuivinen
2005-12-03 10:41 ` [PATCH 4/4] New test case: Criss-cross merge Fredrik Kuivinen
3 siblings, 0 replies; 5+ messages in thread
From: Fredrik Kuivinen @ 2005-12-03 10:41 UTC (permalink / raw)
To: junkio; +Cc: git
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
t/t6020-merge-df.sh | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
create mode 100755 t/t6020-merge-df.sh
b1d7b5544a3890d2beb19286a328bc2f7e92cb6b
diff --git a/t/t6020-merge-df.sh b/t/t6020-merge-df.sh
new file mode 100755
index 0000000..a19d49d
--- /dev/null
+++ b/t/t6020-merge-df.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Fredrik Kuivinen
+#
+
+test_description='Test merge with directory/file conflicts'
+. ./test-lib.sh
+
+test_expect_success 'prepare repository' \
+'echo "Hello" > init &&
+git add init &&
+git commit -m "Initial commit" &&
+git branch B &&
+mkdir dir &&
+echo "foo" > dir/foo &&
+git add dir/foo &&
+git commit -m "File: dir/foo" &&
+git checkout B &&
+echo "file dir" > dir &&
+git add dir &&
+git commit -m "File: dir"'
+
+test_expect_code 1 'Merge with d/f conflicts' 'git merge "merge msg" B master'
+
+test_done
--
0.99.9.GIT
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] New test case: Criss-cross merge
2005-12-03 10:32 [PATCH 0/4] Merge test cases Fredrik Kuivinen
` (2 preceding siblings ...)
2005-12-03 10:41 ` [PATCH 3/4] New test case: merge with directory/file conflicts Fredrik Kuivinen
@ 2005-12-03 10:41 ` Fredrik Kuivinen
3 siblings, 0 replies; 5+ messages in thread
From: Fredrik Kuivinen @ 2005-12-03 10:41 UTC (permalink / raw)
To: junkio; +Cc: git
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
t/t6021-merge-criss-cross.sh | 92 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 92 insertions(+), 0 deletions(-)
create mode 100755 t/t6021-merge-criss-cross.sh
0813848ea43ec76a07fd5bf57dfa68332513d930
diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh
new file mode 100755
index 0000000..e8606c7
--- /dev/null
+++ b/t/t6021-merge-criss-cross.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Fredrik Kuivinen
+#
+
+# See http://marc.theaimsgroup.com/?l=git&m=111463358500362&w=2 for a
+# nice decription of what this is about.
+
+
+test_description='Test criss-cross merge'
+. ./test-lib.sh
+
+test_expect_success 'prepare repository' \
+'echo "1
+2
+3
+4
+5
+6
+7
+8
+9" > file &&
+git add file &&
+git commit -m "Initial commit" file &&
+git branch A &&
+git branch B &&
+git checkout A &&
+echo "1
+2
+3
+4
+5
+6
+7
+8 changed in B8, branch A
+9" > file &&
+git commit -m "B8" file &&
+git checkout B &&
+echo "1
+2
+3 changed in C3, branch B
+4
+5
+6
+7
+8
+9
+" > file &&
+git commit -m "C3" file &&
+git branch C3 &&
+git merge "pre E3 merge" B A &&
+echo "1
+2
+3 changed in E3, branch B. New file size
+4
+5
+6
+7
+8 changed in B8, branch A
+9
+" > file &&
+git commit -m "E3" file &&
+git checkout A &&
+git merge "pre D8 merge" A C3 &&
+echo "1
+2
+3 changed in C3, branch B
+4
+5
+6
+7
+8 changed in D8, branch A. New file size 2
+9" > file &&
+git commit -m D8 file'
+
+test_expect_success 'Criss-cross merge' 'git merge "final merge" A B'
+
+cat > file-expect <<EOF
+1
+2
+3 changed in E3, branch B. New file size
+4
+5
+6
+7
+8 changed in D8, branch A. New file size 2
+9
+EOF
+
+test_expect_success 'Criss-cross merge result' 'cmp file file-expect'
+
+test_done
--
0.99.9.GIT
^ permalink raw reply related [flat|nested] 5+ messages in thread