Merge branch 'nd/pathspec-wildcard'
[gitweb.git] / t / t3600-rm.sh
index 97254e8d337ff066f633ece5d1a7c8a59108e703..37bf5f13b07a632cb8e96e865a75b51f1b7844aa 100755 (executable)
@@ -302,6 +302,23 @@ test_expect_success 'rm removes work tree of unmodified submodules' '
        test_cmp expect actual
 '
 
+test_expect_success 'rm removes a submodule with a trailing /' '
+       git reset --hard &&
+       git submodule update &&
+       git rm submod/ &&
+       test ! -d submod &&
+       git status -s -uno --ignore-submodules=none > actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'rm fails when given a file with a trailing /' '
+       test_must_fail git rm empty/
+'
+
+test_expect_success 'rm succeeds when given a directory with a trailing /' '
+       git rm -r frotz/
+'
+
 test_expect_success 'rm of a populated submodule with different HEAD fails unless forced' '
        git reset --hard &&
        git submodule update &&
@@ -457,7 +474,7 @@ test_expect_success 'rm of a conflicted populated submodule with a .git director
        git submodule update &&
        (cd submod &&
                rm .git &&
-               cp -a ../.git/modules/sub .git &&
+               cp -R ../.git/modules/sub .git &&
                GIT_WORK_TREE=. git config --unset core.worktree
        ) &&
        test_must_fail git merge conflict2 &&
@@ -491,7 +508,7 @@ test_expect_success 'rm of a populated submodule with a .git directory fails eve
        git submodule update &&
        (cd submod &&
                rm .git &&
-               cp -a ../.git/modules/sub .git &&
+               cp -R ../.git/modules/sub .git &&
                GIT_WORK_TREE=. git config --unset core.worktree
        ) &&
        test_must_fail git rm submod &&
@@ -589,7 +606,7 @@ test_expect_success 'rm of a populated nested submodule with a nested .git direc
        git submodule update --recursive &&
        (cd submod/subsubmod &&
                rm .git &&
-               cp -a ../../.git/modules/sub/modules/sub .git &&
+               cp -R ../../.git/modules/sub/modules/sub .git &&
                GIT_WORK_TREE=. git config --unset core.worktree
        ) &&
        test_must_fail git rm submod &&