Imported Upstream version 2.13.0
[platform/upstream/git.git] / t / t4030-diff-textconv.sh
index 53ec330..aad6c7f 100755 (executable)
@@ -58,6 +58,12 @@ test_expect_success 'diff produces text' '
        test_cmp expect.text actual
 '
 
+test_expect_success 'show commit produces text' '
+       git show HEAD >diff &&
+       find_diff <diff >actual &&
+       test_cmp expect.text actual
+'
+
 test_expect_success 'diff-tree produces binary' '
        git diff-tree -p HEAD^ HEAD >diff &&
        find_diff <diff >actual &&
@@ -84,6 +90,24 @@ test_expect_success 'status -v produces text' '
        git reset --soft HEAD@{1}
 '
 
+test_expect_success 'show blob produces binary' '
+       git show HEAD:file >actual &&
+       printf "\\0\\n\\01\\n" >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'show --textconv blob produces text' '
+       git show --textconv HEAD:file >actual &&
+       printf "0\\n1\\n" >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'show --no-textconv blob produces binary' '
+       git show --no-textconv HEAD:file >actual &&
+       printf "\\0\\n\\01\\n" >expect &&
+       test_cmp expect actual
+'
+
 test_expect_success 'grep-diff (-G) operates on textconv data (add)' '
        echo one >expect &&
        git log --root --format=%s -G0 >actual &&
@@ -139,12 +163,10 @@ index 0000000..67be421
 +frotz
 \ No newline at end of file
 EOF
-# make a symlink the hard way that works on symlink-challenged file systems
+
 test_expect_success 'textconv does not act on symlinks' '
-       printf frotz > file &&
-       git add file &&
-       git ls-files -s | sed -e s/100644/120000/ |
-               git update-index --index-info &&
+       rm -f file &&
+       test_ln_s_add frotz file &&
        git commit -m typechange &&
        git show >diff &&
        find_diff <diff >actual &&