Imported Upstream version 2.19.4
[platform/upstream/git.git] / t / t1004-read-tree-m-u-wf.sh
index b3ae7d5..c13578a 100755 (executable)
@@ -30,7 +30,7 @@ test_expect_success 'two-way not clobbering' '
 
        echo >file2 master creates untracked file2 &&
        echo >subdir/file2 master creates untracked subdir/file2 &&
-       if err=`read_tree_u_must_succeed -m -u master side 2>&1`
+       if err=$(read_tree_u_must_succeed -m -u master side 2>&1)
        then
                echo should have complained
                false
@@ -43,7 +43,7 @@ echo file2 >.gitignore
 
 test_expect_success 'two-way with incorrect --exclude-per-directory (1)' '
 
-       if err=`read_tree_u_must_succeed -m --exclude-per-directory=.gitignore master side 2>&1`
+       if err=$(read_tree_u_must_succeed -m --exclude-per-directory=.gitignore master side 2>&1)
        then
                echo should have complained
                false
@@ -54,7 +54,7 @@ test_expect_success 'two-way with incorrect --exclude-per-directory (1)' '
 
 test_expect_success 'two-way with incorrect --exclude-per-directory (2)' '
 
-       if err=`read_tree_u_must_succeed -m -u --exclude-per-directory=foo --exclude-per-directory=.gitignore master side 2>&1`
+       if err=$(read_tree_u_must_succeed -m -u --exclude-per-directory=foo --exclude-per-directory=.gitignore master side 2>&1)
        then
                echo should have complained
                false
@@ -95,7 +95,7 @@ test_expect_success 'three-way not clobbering a working tree file' '
        git checkout master &&
        echo >file3 file three created in master, untracked &&
        echo >subdir/file3 file three created in master, untracked &&
-       if err=`read_tree_u_must_succeed -m -u branch-point master side 2>&1`
+       if err=$(read_tree_u_must_succeed -m -u branch-point master side 2>&1)
        then
                echo should have complained
                false
@@ -158,7 +158,7 @@ test_expect_success '3-way not overwriting local changes (their side)' '
 
 '
 
-test_expect_success SYMLINKS 'funny symlink in work tree' '
+test_expect_success 'funny symlink in work tree' '
 
        git reset --hard &&
        git checkout -b sym-b side-b &&
@@ -170,15 +170,16 @@ test_expect_success SYMLINKS 'funny symlink in work tree' '
        rm -fr a &&
        git checkout -b sym-a side-a &&
        mkdir -p a &&
-       ln -s ../b a/b &&
-       git add a/b &&
+       test_ln_s_add ../b a/b &&
        git commit -m "we add a/b" &&
 
        read_tree_u_must_succeed -m -u sym-a sym-a sym-b
 
 '
 
-test_expect_success SYMLINKS,SANITY 'funny symlink in work tree, un-unlink-able' '
+test_expect_success SANITY 'funny symlink in work tree, un-unlink-able' '
+
+       test_when_finished "chmod u+w a 2>/dev/null; rm -fr a b" &&
 
        rm -fr a b &&
        git reset --hard &&
@@ -189,10 +190,6 @@ test_expect_success SYMLINKS,SANITY 'funny symlink in work tree, un-unlink-able'
 
 '
 
-# clean-up from the above test
-chmod a+w a 2>/dev/null
-rm -fr a b
-
 test_expect_success 'D/F setup' '
 
        git reset --hard &&
@@ -213,13 +210,13 @@ test_expect_success 'D/F' '
        read_tree_u_must_succeed -m -u branch-point side-b side-a &&
        git ls-files -u >actual &&
        (
-               a=$(git rev-parse branch-point:subdir/file2)
-               b=$(git rev-parse side-a:subdir/file2/another)
-               echo "100644 $a 1       subdir/file2"
-               echo "100644 $a 2       subdir/file2"
+               a=$(git rev-parse branch-point:subdir/file2) &&
+               b=$(git rev-parse side-a:subdir/file2/another) &&
+               echo "100644 $a 1       subdir/file2" &&
+               echo "100644 $a 2       subdir/file2" &&
                echo "100644 $b 3       subdir/file2/another"
        ) >expect &&
-       test_cmp actual expect
+       test_cmp expect actual
 
 '