diff options
author | Karl Wiberg <kha@treskal.com> | 2011-06-01 09:16:06 +0200 |
---|---|---|
committer | Karl Wiberg <kha@treskal.com> | 2011-06-01 09:16:06 +0200 |
commit | 31c3f7c9c8f175fd06fa565ea905be30b57b6e88 (patch) | |
tree | 2cc614304207fb1a7a19f0ac2249f8df397561b6 | |
parent | 8a7085ff4d5b65e5d254b5388df9b8ec9f4f905c (diff) | |
download | stgit-31c3f7c9c8f175fd06fa565ea905be30b57b6e88.tar.gz |
Add two tests (one currently failing) for "stg float" causing conflicts
Signed-off-by: Karl Wiberg <kha@treskal.com>
-rwxr-xr-x | t/t1502-float-conflict-1.sh | 38 | ||||
-rwxr-xr-x | t/t1503-float-conflict-2.sh | 42 |
2 files changed, 80 insertions, 0 deletions
diff --git a/t/t1502-float-conflict-1.sh b/t/t1502-float-conflict-1.sh new file mode 100755 index 0000000..7356d27 --- /dev/null +++ b/t/t1502-float-conflict-1.sh @@ -0,0 +1,38 @@ +#!/bin/sh +test_description='Test that "stg float" can handle conflicts' +. ./test-lib.sh + +test_expect_success 'Test setup' ' + stg init && + echo expected.txt >> .git/info/exclude && + echo first line > foo.txt && + git add foo.txt && + git commit -m p0 && + echo foo >> foo.txt && + git add foo.txt && + git commit -m p1 && + echo foo2 >> foo.txt && + git add foo.txt && + git commit -m p2 && + stg uncommit -n 3 +' + +cat > expected.txt <<EOF +first line +<<<<<<< current +======= +foo +foo2 +>>>>>>> patched +EOF + +test_expect_success 'Float a patch, causing a conflict with the next patch' ' + conflict stg float p1 && + test "$(echo $(stg series))" = "+ p0 > p2 - p1" && + test "$(stg id p2)" = "$(git rev-list HEAD~0 -n 1)" && + test "$(stg id p0)" = "$(git rev-list HEAD~1 -n 1)" && + test "$(stg status)" = "C foo.txt" && + test_cmp foo.txt expected.txt +' + +test_done diff --git a/t/t1503-float-conflict-2.sh b/t/t1503-float-conflict-2.sh new file mode 100755 index 0000000..661b711 --- /dev/null +++ b/t/t1503-float-conflict-2.sh @@ -0,0 +1,42 @@ +#!/bin/sh +test_description='Test that "stg float" can handle conflicts' +. ./test-lib.sh + +test_expect_success 'Test setup' ' + stg init && + echo expected.txt >> .git/info/exclude && + echo first line > foo.txt && + git add foo.txt && + git commit -m p0 && + echo foo >> foo.txt && + git add foo.txt && + git commit -m p1 && + echo bar >> bar.txt && + git add bar.txt && + git commit -m p2 && + echo foo2 >> foo.txt && + git add foo.txt && + git commit -m p3 && + stg uncommit -n 4 +' + +cat > expected.txt <<EOF +first line +<<<<<<< current +======= +foo +foo2 +>>>>>>> patched +EOF + +test_expect_failure 'Float a patch, causing a conflict two patches down' ' + conflict stg float p1 && + test "$(echo $(stg series))" = "+ p0 + p2 > p3 - p1" && + test "$(stg id p3)" = "$(git rev-list HEAD~0 -n 1)" && + test "$(stg id p2)" = "$(git rev-list HEAD~1 -n 1)" && + test "$(stg id p0)" = "$(git rev-list HEAD~2 -n 1)" && + test "$(stg status)" = "C foo.txt" && + test_cmp foo.txt expected.txt +' + +test_done |