git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Clément Poulain" <clement.poulain@ensimag.imag.fr>
To: git@vger.kernel.org
Cc: spearce@spearce.org, drizzd@aon.at, matthieu.moy@grenoble-inp.fr,
	"Clément Poulain" <clement.poulain@ensimag.imag.fr>,
	"Diane Gasselin" <diane.gasselin@ensimag.imag.fr>,
	"Axel Bonnet" <axel.bonnet@ensimag.imag.fr>
Subject: [RFC/PATCH 4/4] t/t8007: test textconv support for cat-file
Date: Sun,  6 Jun 2010 13:30:48 +0200	[thread overview]
Message-ID: <1275823848-7151-5-git-send-email-clement.poulain@ensimag.imag.fr> (raw)
In-Reply-To: <1275823848-7151-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 |   66 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 66 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..0789912
--- /dev/null
+++ b/t/t8007-cat-file-textconv.sh
@@ -0,0 +1,66 @@
+#!/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
+test version 2
+EOF
+
+test_expect_success 'no filter specified' '
+	git cat-file --textconv :one.bin >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
+'
+
+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.6.6.7.ga5fe3

  reply	other threads:[~2010-06-06 11:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-06 11:30 [RFC/PATCH 0/4] git-gui blame: use textconv Clément Poulain
2010-06-06 11:30 ` [RFC/PATCH 1/4] sha1_name: creating context cache Clément Poulain
2010-06-06 11:30   ` [RFC/PATCH 2/4] textconv: support for cat-file Clément Poulain
2010-06-06 11:30     ` [RFC/PATCH 3/4] git-gui: use textconv filter for diff and blame Clément Poulain
2010-06-06 11:30       ` Clément Poulain [this message]
2010-06-06 15:56   ` [RFC/PATCH 1/4] sha1_name: creating context cache Matthieu Moy
2010-06-06 22:15     ` Jeff King
2010-06-07  8:34       ` Clément Poulain

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1275823848-7151-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=drizzd@aon.at \
    --cc=git@vger.kernel.org \
    --cc=matthieu.moy@grenoble-inp.fr \
    --cc=spearce@spearce.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.
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 NNTP newsgroup(s).