summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2013-05-10 17:10:10 +0200
committerJunio C Hamano <gitster@pobox.com>2013-05-10 10:23:51 -0700
commit4bd52d0956f5ba2a922968057cabd77a98f6da5c (patch)
treee578c5f2a4ff993e5abc8c2e239bd4899d45ec60
parent1468a5839309033feb2e58943babdd48b8e2d151 (diff)
downloadgit-4bd52d0956f5ba2a922968057cabd77a98f6da5c.tar.gz
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>
-rwxr-xr-xt/t4030-diff-textconv.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/t4030-diff-textconv.sh b/t/t4030-diff-textconv.sh
index 53ec330ce8..3950fc9858 100755
--- a/t/t4030-diff-textconv.sh
+++ b/t/t4030-diff-textconv.sh
@@ -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_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 &&