Skip to content

Commit 4bd52d0

Browse files
Michael J Grubergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1468a58 commit 4bd52d0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

t/t4030-diff-textconv.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ test_expect_success 'diff produces text' '
5858
test_cmp expect.text actual
5959
'
6060

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+
6167
test_expect_success 'diff-tree produces binary' '
6268
git diff-tree -p HEAD^ HEAD >diff &&
6369
find_diff <diff >actual &&
@@ -84,6 +90,24 @@ test_expect_success 'status -v produces text' '
8490
git reset --soft HEAD@{1}
8591
'
8692

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+
87111
test_expect_success 'grep-diff (-G) operates on textconv data (add)' '
88112
echo one >expect &&
89113
git log --root --format=%s -G0 >actual &&

0 commit comments

Comments
 (0)