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/t8006-blame-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 / t8006-blame-textconv.sh` 158 lines ยท 4438 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='git blame textconv support' 4 5 . ./test-lib.sh 6 7 find_blame() { 8 sed -e 's/^[^(]*//' 9 } 10 11 cat >helper <<'EOF' 12 #!/bin/sh 13 grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; } 14 sed 's/^bin: /converted: /' "$1" 15 EOF 16 chmod +x helper 17 18 test_expect_success 'setup ' ' 19 echo "bin: test number 0" >zero.bin && 20 echo "bin: test 1" >one.bin && 21 echo "bin: test number 2" >two.bin && 22 test_ln_s_add one.bin symlink.bin && 23 git add . && 24 GIT_AUTHOR_NAME=Number1 git commit -a -m First --date="2010-01-01 18:00:00" && 25 echo "bin: test 1 version 2" >one.bin && 26 echo "bin: test number 2 version 2" >>two.bin && 27 rm -f symlink.bin && 28 test_ln_s_add two.bin symlink.bin && 29 GIT_AUTHOR_NAME=Number2 git commit -a -m Second --date="2010-01-01 20:00:00" 30 ' 31 32 cat >expected <blame && 38 find_blame Number2 result && 39 test_cmp expected result 40 ' 41 42 test_expect_success 'setup textconv filters' ' 43 echo "*.bin diff=test" >.gitattributes && 44 echo "zero.bin eol=crlf" >>.gitattributes && 45 git config diff.test.textconv ./helper && 46 git config diff.test.cachetextconv false 47 ' 48 49 test_expect_success 'blame with --no-textconv' ' 50 git blame --no-textconv one.bin >blame && 51 find_blame result && 52 test_cmp expected result 53 ' 54 55 cat >expected <blame && 61 find_blame result && 62 test_cmp expected result 63 ' 64 65 cat >expected <blame && 72 find_blame result && 73 test_cmp expected result 74 ' 75 76 test_expect_success 'blame --textconv with local changes' ' 77 test_when_finished "git checkout zero.bin" && 78 printf "bin: updated number 0\015" >zero.bin && 79 git blame --textconv zero.bin >blame && 80 expect="(Not Committed Yet ....-..-.. ..:..:.. +0000 1)" && 81 expect="$expect converted: updated number 0" && 82 expr "$(find_blame expected_one <blame && 95 find_blame result && 96 test_cmp expected result && 97 git blame --textconv one.bin >blame && 98 find_blame result && 99 test_cmp expected_one result 100 ' 101 102 test_expect_success 'setup -cachetextconv' ' 103 git config diff.test.cachetextconv false 104 ' 105 106 test_expect_success 'make a new commit' ' 107 echo "bin: test number 2 version 3" >>two.bin && 108 GIT_AUTHOR_NAME=Number3 git commit -a -m Third --date="2010-01-01 22:00:00" 109 ' 110 111 test_expect_success 'blame from previous revision' ' 112 git blame HEAD^ two.bin >blame && 113 find_blame result && 114 test_cmp expected result 115 ' 116 117 cat >expected <blame && 123 find_blame result && 124 test_cmp expected result 125 ' 126 127 test_expect_success SYMLINKS 'blame --textconv (on symlink)' ' 128 git blame --textconv symlink.bin >blame && 129 find_blame result && 130 test_cmp expected result 131 ' 132 133 # cp two.bin three.bin and make small tweak 134 # (this will direct blame -C -C three.bin to consider two.bin and symlink.bin) 135 test_expect_success 'make another new commit' ' 136 cat >three.bin <<\EOF && 137 bin: test number 2 138 bin: test number 2 version 2 139 bin: test number 2 version 3 140 bin: test number 3 141 EOF 142 git add three.bin && 143 GIT_AUTHOR_NAME=Number4 git commit -a -m Fourth --date="2010-01-01 23:00:00" 144 ' 145 146 test_expect_success 'blame on last commit (-C -C, symlink)' ' 147 git blame -C -C three.bin >blame && 148 find_blame result && 149 cat >expected <<\EOF && 150 (Number1 2010-01-01 18:00:00 +0000 1) converted: test number 2 151 (Number2 2010-01-01 20:00:00 +0000 2) converted: test number 2 version 2 152 (Number3 2010-01-01 22:00:00 +0000 3) converted: test number 2 version 3 153 (Number4 2010-01-01 23:00:00 +0000 4) converted: test number 3 154 EOF 155 test_cmp expected result 156 ' 157 158 test_done