diff options
Diffstat (limited to 't/t8007-cat-file-textconv.sh')
-rwxr-xr-x | t/t8007-cat-file-textconv.sh | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh index 38ac05e4a0..78a0085e64 100755 --- a/t/t8007-cat-file-textconv.sh +++ b/t/t8007-cat-file-textconv.sh @@ -5,15 +5,19 @@ 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 && + if test_have_prereq SYMLINKS; then + ln -s one.bin symlink.bin + fi && 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" ' @@ -33,7 +37,7 @@ test_expect_success 'setup textconv filters' ' ' cat >expected <<EOF -test version 2 +bin: test version 2 EOF test_expect_success 'cat-file without --textconv' ' @@ -42,7 +46,7 @@ test_expect_success 'cat-file without --textconv' ' ' cat >expected <<EOF -test +bin: test EOF test_expect_success 'cat-file without --textconv on previous commit' ' @@ -67,4 +71,28 @@ test_expect_success 'cat-file --textconv on previous commit' ' git cat-file --textconv HEAD^:one.bin >result && test_cmp expected result ' + +test_expect_success SYMLINKS 'cat-file without --textconv (symlink)' ' + git cat-file blob :symlink.bin >result && + printf "%s" "one.bin" >expected + test_cmp expected result +' + + +test_expect_success SYMLINKS 'cat-file --textconv on index (symlink)' ' + ! git cat-file --textconv :symlink.bin 2>result && + cat >expected <<\EOF && +fatal: git cat-file --textconv: unable to run textconv on :symlink.bin +EOF + test_cmp expected result +' + +test_expect_success SYMLINKS 'cat-file --textconv on HEAD (symlink)' ' + ! git cat-file --textconv HEAD:symlink.bin 2>result && + cat >expected <<EOF && +fatal: git cat-file --textconv: unable to run textconv on HEAD:symlink.bin +EOF + test_cmp expected result +' + test_done |