Skip to content

Commit

Permalink
t4030: demonstrate behavior of show with textconv
Browse files Browse the repository at this point in the history
"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>
  • Loading branch information
Michael J Gruber authored and Junio C Hamano committed May 10, 2013
1 parent 1468a58 commit 4bd52d0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions t/t4030-diff-textconv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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_failure 'show --textconv blob produces text' '
git show --textconv HEAD:file >actual &&
printf "0\\n1\\n" >expect &&
test_cmp expect actual
'

test_success 'show --no-textconv blob produces binary' '
git show --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 &&
Expand Down

0 comments on commit 4bd52d0

Please sign in to comment.