summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-06-27 07:23:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-27 18:23:22 (GMT)
commit16346883ab0f548aa57ed5617caacc66c0a25bea (patch)
tree7daafd5cdbb059fdf3ecfc3461579f572f2cfc90
parent0661e49aeb842a29f2ebbd7b005ec5824c2b87e1 (diff)
downloadgit-16346883ab0f548aa57ed5617caacc66c0a25bea.zip
git-16346883ab0f548aa57ed5617caacc66c0a25bea.tar.gz
git-16346883ab0f548aa57ed5617caacc66c0a25bea.tar.bz2
t3401: add directory rename testcases for rebase and am
Add a simple directory rename testcase, in conjunction with each of the types of rebases: git-rebase--interactive git-rebase--am git-rebase--merge and also use the same testcase for git am --3way This demonstrates a difference in behavior between the different rebase backends in regards to directory rename detection. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t3401-rebase-and-am-rename.sh105
1 files changed, 105 insertions, 0 deletions
diff --git a/t/t3401-rebase-and-am-rename.sh b/t/t3401-rebase-and-am-rename.sh
new file mode 100755
index 0000000..8f83295
--- /dev/null
+++ b/t/t3401-rebase-and-am-rename.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+test_description='git rebase + directory rename tests'
+
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-rebase.sh
+
+test_expect_success 'setup testcase' '
+ test_create_repo dir-rename &&
+ (
+ cd dir-rename &&
+
+ mkdir x &&
+ test_seq 1 10 >x/a &&
+ test_seq 11 20 >x/b &&
+ test_seq 21 30 >x/c &&
+ test_write_lines a b c d e f g h i >l &&
+ git add x l &&
+ git commit -m "Initial" &&
+
+ git branch O &&
+ git branch A &&
+ git branch B &&
+
+ git checkout A &&
+ git mv x y &&
+ git mv l letters &&
+ git commit -m "Rename x to y, l to letters" &&
+
+ git checkout B &&
+ echo j >>l &&
+ test_seq 31 40 >x/d &&
+ git add l x/d &&
+ git commit -m "Modify l, add x/d"
+ )
+'
+
+test_expect_success 'rebase --interactive: directory rename detected' '
+ (
+ cd dir-rename &&
+
+ git checkout B^0 &&
+
+ set_fake_editor &&
+ FAKE_LINES="1" git rebase --interactive A &&
+
+ git ls-files -s >out &&
+ test_line_count = 5 out &&
+
+ test_path_is_file y/d &&
+ test_path_is_missing x/d
+ )
+'
+
+test_expect_failure 'rebase (am): directory rename detected' '
+ (
+ cd dir-rename &&
+
+ git checkout B^0 &&
+
+ git rebase A &&
+
+ git ls-files -s >out &&
+ test_line_count = 5 out &&
+
+ test_path_is_file y/d &&
+ test_path_is_missing x/d
+ )
+'
+
+test_expect_success 'rebase --merge: directory rename detected' '
+ (
+ cd dir-rename &&
+
+ git checkout B^0 &&
+
+ git rebase --merge A &&
+
+ git ls-files -s >out &&
+ test_line_count = 5 out &&
+
+ test_path_is_file y/d &&
+ test_path_is_missing x/d
+ )
+'
+
+test_expect_failure 'am: directory rename detected' '
+ (
+ cd dir-rename &&
+
+ git checkout A^0 &&
+
+ git format-patch -1 B &&
+
+ git am --3way 0001*.patch &&
+
+ git ls-files -s >out &&
+ test_line_count = 5 out &&
+
+ test_path_is_file y/d &&
+ test_path_is_missing x/d
+ )
+'
+
+test_done