summaryrefslogtreecommitdiff
path: root/t/t8007-cat-file-textconv.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t8007-cat-file-textconv.sh')
-rwxr-xr-xt/t8007-cat-file-textconv.sh36
1 files changed, 26 insertions, 10 deletions
diff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh
index 38ac05e4a0..eacd49ade6 100755
--- a/t/t8007-cat-file-textconv.sh
+++ b/t/t8007-cat-file-textconv.sh
@@ -5,24 +5,26 @@ test_description='git cat-file textconv support'
cat >helper <<'EOF'
#!/bin/sh
-sed 's/^/converted: /' "$@"
+grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; }
+sed 's/^bin: /converted: /' "$1"
EOF
chmod +x helper
test_expect_success 'setup ' '
- echo test >one.bin &&
+ echo "bin: test" >one.bin &&
+ test_ln_s_add one.bin symlink.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 &&
+ echo "bin: 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
+bin: test version 2
EOF
test_expect_success 'no filter specified' '
- git cat-file --textconv :one.bin 2>result
+ git cat-file --textconv :one.bin >result &&
test_cmp expected result
'
@@ -32,17 +34,13 @@ test_expect_success 'setup textconv filters' '
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
+bin: test
EOF
test_expect_success 'cat-file without --textconv on previous commit' '
@@ -67,4 +65,22 @@ test_expect_success 'cat-file --textconv on previous commit' '
git cat-file --textconv HEAD^:one.bin >result &&
test_cmp expected result
'
+
+test_expect_success 'cat-file without --textconv (symlink)' '
+ printf "%s" "one.bin" >expected &&
+ git cat-file blob :symlink.bin >result &&
+ test_cmp expected result
+'
+
+
+test_expect_success 'cat-file --textconv on index (symlink)' '
+ git cat-file --textconv :symlink.bin >result &&
+ test_cmp expected result
+'
+
+test_expect_success 'cat-file --textconv on HEAD (symlink)' '
+ git cat-file --textconv HEAD:symlink.bin >result &&
+ test_cmp expected result
+'
+
test_done