t4030: demonstrate behavior of show with textconv
"git show <commit>" honors the --textconv option while "git show <blob>" does not. Demonstrate this in the test. Since the current behavior is supposed to stay as is, we expect the default for "git show <blob>" to remain --no-textconv. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael J Gruber committed
May 10, 2013 at 17:10 UTC
4bd52d0956f5ba2a922968057cabd77a98f6da5c
1 file changed
+24
t/t4030-diff-textconv.sh
+24
@@ -58,6 +58,12 @@ test_expect_success 'diff produces text' '
58
test_cmp expect.text actual
59
'
60
61
+test_expect_success 'show commit produces text' '
62
+ git show HEAD >diff &&
63
+ find_diff <diff >actual &&
64
+ test_cmp expect.text actual
65
+'
66
+
67
test_expect_success 'diff-tree produces binary' '
68
git diff-tree -p HEAD^ HEAD >diff &&
69
find_diff <diff >actual &&
@@ -84,6 +90,24 @@ test_expect_success 'status -v produces text' '
90
git reset --soft HEAD@{1}
91
'
92
93
+test_expect_success 'show blob produces binary' '
94
+ git show HEAD:file >actual &&
95
+ printf "\\0\\n\\01\\n" >expect &&
96
+ test_cmp expect actual
97
+'
98
+
99
+test_expect_failure 'show --textconv blob produces text' '
100
+ git show --textconv HEAD:file >actual &&
101
+ printf "0\\n1\\n" >expect &&
102
+ test_cmp expect actual
103
+'
104
+
105
+test_success 'show --no-textconv blob produces binary' '
106
+ git show --textconv HEAD:file >actual &&
107
+ printf "\\0\\n\\01\\n" >expect &&
108
+ test_cmp expect actual
109
+'
110
+
111
test_expect_success 'grep-diff (-G) operates on textconv data (add)' '
112
echo one >expect &&
113
git log --root --format=%s -G0 >actual &&