]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t7001-mv.sh
checkout -p: handle tree arguments correctly again
[thirdparty/git.git] / t / t7001-mv.sh
index d4e6485a26eef8985856413a1bf977c95f6ec345..36b50d0b4c1255408d57b4e8b583cfcd41ce9c0d 100755 (executable)
@@ -21,8 +21,8 @@ test_expect_success \
 
 test_expect_success \
     'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD | \
-    grep "^R100..*path0/COPYING..*path1/COPYING"'
+    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+    grep "^R100..*path0/COPYING..*path1/COPYING" actual'
 
 test_expect_success \
     'moving the file back into subdirectory' \
@@ -35,8 +35,8 @@ test_expect_success \
 
 test_expect_success \
     'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD | \
-    grep "^R100..*path1/COPYING..*path0/COPYING"'
+    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+    grep "^R100..*path1/COPYING..*path0/COPYING" actual'
 
 test_expect_success \
     'mv --dry-run does not move file' \
@@ -122,10 +122,9 @@ test_expect_success \
 
 test_expect_success \
     'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD | \
-     grep "^R100..*path0/COPYING..*path2/COPYING" &&
-     git diff-tree -r -M --name-status  HEAD^ HEAD | \
-     grep "^R100..*path0/README..*path2/README"'
+    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path0/COPYING..*path2/COPYING" actual &&
+     grep "^R100..*path0/README..*path2/README" actual'
 
 test_expect_success \
     'succeed when source is a prefix of destination' \
@@ -141,10 +140,9 @@ test_expect_success \
 
 test_expect_success \
     'checking the commit' \
-    'git diff-tree -r -M --name-status  HEAD^ HEAD | \
-     grep "^R100..*path2/COPYING..*path1/path2/COPYING" &&
-     git diff-tree -r -M --name-status  HEAD^ HEAD | \
-     grep "^R100..*path2/README..*path1/path2/README"'
+    'git diff-tree -r -M --name-status  HEAD^ HEAD >actual &&
+     grep "^R100..*path2/COPYING..*path1/path2/COPYING" actual &&
+     grep "^R100..*path2/README..*path1/path2/README" actual'
 
 test_expect_success \
     'do not move directory over existing directory' \
@@ -386,7 +384,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
        entry="$(git ls-files --stage sub | cut -f 1)" &&
        mkdir mod &&
        git mv sub mod/sub 2>actual.err &&
-       ! test -s actual.err &&
+       test_must_be_empty actual.err &&
        ! test -e sub &&
        [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
        (
@@ -410,7 +408,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
        git diff-files --quiet -- sub &&
        git add .gitmodules &&
        git mv sub mod/sub 2>actual.err &&
-       ! test -s actual.err &&
+       test_must_be_empty actual.err &&
        ! test -e sub &&
        [ "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" ] &&
        (
@@ -471,7 +469,7 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
        git update-index --refresh &&
        git diff-files --quiet -- sub .gitmodules &&
        git status -s sub2 >actual &&
-       ! test -s actual
+       test_must_be_empty actual
 '
 
 test_expect_success 'mv -k does not accidentally destroy submodules' '
@@ -497,7 +495,7 @@ test_expect_success 'moving a submodule in nested directories' '
        test_cmp expect actual
 '
 
-test_expect_failure 'moving nested submodules' '
+test_expect_success 'moving nested submodules' '
        git commit -am "cleanup commit" &&
        mkdir sub_nested_nested &&
        (cd sub_nested_nested &&
@@ -511,7 +509,7 @@ test_expect_failure 'moving nested submodules' '
                touch nested_level1 &&
                git init &&
                git add . &&
-               git commit -m "nested level 1"
+               git commit -m "nested level 1" &&
                git submodule add ../sub_nested_nested &&
                git commit -m "add nested level 2"
        ) &&