From: "Clément Poulain" <clement.poulain@ensimag.imag.fr>
To: git@vger.kernel.org
Cc: "Clément Poulain" <clement.poulain@ensimag.imag.fr>,
"Diane Gasselin" <diane.gasselin@ensimag.imag.fr>,
"Axel Bonnet" <axel.bonnet@ensimag.imag.fr>
Subject: [PATCH v2 4/4] t/t8007: test textconv support for cat-file
Date: Tue, 8 Jun 2010 15:49:18 +0200 [thread overview]
Message-ID: <1276004958-13540-5-git-send-email-clement.poulain@ensimag.imag.fr> (raw)
In-Reply-To: <1276004958-13540-4-git-send-email-clement.poulain@ensimag.imag.fr>
Test the correct functionning of textconv with cat-file <sha1:blob>
and cat-file HEAD^ <file>. Test the case when no driver is specified
Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
---
t/t8007-cat-file-textconv.sh | 70 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 0 deletions(-)
create mode 100755 t/t8007-cat-file-textconv.sh
diff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh
new file mode 100755
index 0000000..38ac05e
--- /dev/null
+++ b/t/t8007-cat-file-textconv.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+test_description='git cat-file textconv support'
+. ./test-lib.sh
+
+cat >helper <<'EOF'
+#!/bin/sh
+sed 's/^/converted: /' "$@"
+EOF
+chmod +x helper
+
+test_expect_success 'setup ' '
+ echo test >one.bin &&
+ git add . &&
+ GIT_AUTHOR_NAME=Number1 git commit -a -m First --date="2010-01-01 18:00:00" &&
+ echo test version 2 >one.bin &&
+ GIT_AUTHOR_NAME=Number2 git commit -a -m Second --date="2010-01-01 20:00:00"
+'
+
+cat >expected <<EOF
+fatal: git cat-file --textconv: unable to run textconv on :one.bin
+EOF
+
+test_expect_success 'no filter specified' '
+ git cat-file --textconv :one.bin 2>result
+ test_cmp expected result
+'
+
+test_expect_success 'setup textconv filters' '
+ echo "*.bin diff=test" >.gitattributes &&
+ git config diff.test.textconv ./helper &&
+ git config diff.test.cachetextconv false
+'
+
+cat >expected <<EOF
+test version 2
+EOF
+
+test_expect_success 'cat-file without --textconv' '
+ git cat-file blob :one.bin >result &&
+ test_cmp expected result
+'
+
+cat >expected <<EOF
+test
+EOF
+
+test_expect_success 'cat-file without --textconv on previous commit' '
+ git cat-file -p HEAD^:one.bin >result &&
+ test_cmp expected result
+'
+
+cat >expected <<EOF
+converted: test version 2
+EOF
+
+test_expect_success 'cat-file --textconv on last commit' '
+ git cat-file --textconv :one.bin >result &&
+ test_cmp expected result
+'
+
+cat >expected <<EOF
+converted: test
+EOF
+
+test_expect_success 'cat-file --textconv on previous commit' '
+ git cat-file --textconv HEAD^:one.bin >result &&
+ test_cmp expected result
+'
+test_done
--
1.7.1.202.g79415.dirty
next prev parent reply other threads:[~2010-06-08 13:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-08 13:49 [PATCH v2 0/4] git-gui blame: use textconv Clément Poulain
2010-06-08 13:49 ` [PATCH v2 1/4] sha1_name: add get_sha1_with_context() Clément Poulain
2010-06-08 13:49 ` [PATCH v2 2/4] textconv: support for cat_file Clément Poulain
2010-06-08 13:49 ` [PATCH v2 3/4] git gui: use textconv filter for diff and blame Clément Poulain
2010-06-08 13:49 ` Clément Poulain [this message]
2010-06-08 18:12 ` [PATCH v2 2/4] textconv: support for cat_file Matthieu Moy
2010-06-08 17:57 ` [PATCH v2 1/4] sha1_name: add get_sha1_with_context() Matthieu Moy
2010-06-08 22:30 ` Clément Poulain
2010-06-09 6:13 ` Jeff King
2010-06-09 7:29 ` Matthieu Moy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1276004958-13540-5-git-send-email-clement.poulain@ensimag.imag.fr \
--to=clement.poulain@ensimag.imag.fr \
--cc=axel.bonnet@ensimag.imag.fr \
--cc=diane.gasselin@ensimag.imag.fr \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).