Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t8007-cat-file-textconv.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t8007-cat-file-textconv.sh` 129 lines ยท 3127 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='git cat-file textconv support' 4 5 . ./test-lib.sh 6 7 cat >helper <<'EOF' 8 #!/bin/sh 9 grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; } 10 sed 's/^bin: /converted: /' "$1" 11 EOF 12 chmod +x helper 13 14 test_expect_success 'setup ' ' 15 echo "bin: test" >one.bin && 16 test_ln_s_add one.bin symlink.bin && 17 git add . && 18 GIT_AUTHOR_NAME=Number1 git commit -a -m First --date="2010-01-01 18:00:00" && 19 echo "bin: test version 2" >one.bin && 20 GIT_AUTHOR_NAME=Number2 git commit -a -m Second --date="2010-01-01 20:00:00" 21 ' 22 23 test_expect_success 'usage: ' ' 24 cat >expect <<-\EOF && 25 fatal: Not a valid object name HEAD2 26 EOF 27 test_must_fail git cat-file --textconv HEAD2 2>actual && 28 test_cmp expect actual 29 ' 30 31 test_expect_success 'usage: :' ' 32 cat >expect <<-\EOF && 33 fatal: invalid object name '\''HEAD2'\''. 34 EOF 35 test_must_fail git cat-file --textconv HEAD2:two.bin 2>actual && 36 test_cmp expect actual 37 ' 38 39 test_expect_success 'usage: :' ' 40 cat >expect <<-\EOF && 41 fatal: path '\''two.bin'\'' does not exist in '\''HEAD'\'' 42 EOF 43 test_must_fail git cat-file --textconv HEAD:two.bin 2>actual && 44 test_cmp expect actual 45 ' 46 47 48 test_expect_success 'usage: with no ' ' 49 cat >expect <<-\EOF && 50 fatal: : required, only '\''HEAD'\'' given 51 EOF 52 test_must_fail git cat-file --textconv HEAD 2>actual && 53 test_cmp expect actual 54 ' 55 56 57 test_expect_success 'usage: :' ' 58 cat >expect <<-\EOF && 59 fatal: invalid object name '\''HEAD2'\''. 60 EOF 61 test_must_fail git cat-file --textconv HEAD2:one.bin 2>actual && 62 test_cmp expect actual 63 ' 64 65 cat >expected <result && 71 test_cmp expected result 72 ' 73 74 test_expect_success 'setup textconv filters' ' 75 echo "*.bin diff=test" >.gitattributes && 76 git config diff.test.textconv ./helper && 77 git config diff.test.cachetextconv false 78 ' 79 80 test_expect_success 'cat-file without --textconv' ' 81 git cat-file blob :one.bin >result && 82 test_cmp expected result 83 ' 84 85 cat >expected <result && 91 test_cmp expected result 92 ' 93 94 cat >expected <result && 100 test_cmp expected result 101 ' 102 103 cat >expected <result && 109 test_cmp expected result 110 ' 111 112 test_expect_success 'cat-file without --textconv (symlink)' ' 113 printf "%s" "one.bin" >expected && 114 git cat-file blob :symlink.bin >result && 115 test_cmp expected result 116 ' 117 118 119 test_expect_success 'cat-file --textconv on index (symlink)' ' 120 git cat-file --textconv :symlink.bin >result && 121 test_cmp expected result 122 ' 123 124 test_expect_success 'cat-file --textconv on HEAD (symlink)' ' 125 git cat-file --textconv HEAD:symlink.bin >result && 126 test_cmp expected result 127 ' 128 129 test_done