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/t4024-diff-optimize-common.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 / t4024-diff-optimize-common.sh` 157 lines ยท 2807 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='common tail optimization' 4 5 . ./test-lib.sh 6 7 z=zzzzzzzz ;# 8 8 z="$z$z$z$z$z$z$z$z" ;# 64 9 z="$z$z$z$z$z$z$z$z" ;# 512 10 z="$z$z$z$z" ;# 2048 11 z2047=$(expr "$z" : '.\(.*\)') ; #2047 12 13 x=zzzzzzzzzz ;# 10 14 y="$x$x$x$x$x$x$x$x$x$x" ;# 100 15 z="$y$y$y$y$y$y$y$y$y$y" ;# 1000 16 z1000=$z 17 z100=$y 18 z10=$x 19 20 zs() { 21 count="$1" 22 while test "$count" -ge 1000 23 do 24 count=$(($count - 1000)) 25 printf "%s" $z1000 26 done 27 while test "$count" -ge 100 28 do 29 count=$(($count - 100)) 30 printf "%s" $z100 31 done 32 while test "$count" -ge 10 33 do 34 count=$(($count - 10)) 35 printf "%s" $z10 36 done 37 while test "$count" -ge 1 38 do 39 count=$(($count - 1)) 40 printf "z" 41 done 42 } 43 44 zc () { 45 sed -e "/^index/d" \ 46 -e "s/$z1000/Q/g" \ 47 -e "s/QQQQQQQQQ/Z9000/g" \ 48 -e "s/QQQQQQQQ/Z8000/g" \ 49 -e "s/QQQQQQQ/Z7000/g" \ 50 -e "s/QQQQQQ/Z6000/g" \ 51 -e "s/QQQQQ/Z5000/g" \ 52 -e "s/QQQQ/Z4000/g" \ 53 -e "s/QQQ/Z3000/g" \ 54 -e "s/QQ/Z2000/g" \ 55 -e "s/Q/Z1000/g" \ 56 -e "s/$z100/Q/g" \ 57 -e "s/QQQQQQQQQ/Z900/g" \ 58 -e "s/QQQQQQQQ/Z800/g" \ 59 -e "s/QQQQQQQ/Z700/g" \ 60 -e "s/QQQQQQ/Z600/g" \ 61 -e "s/QQQQQ/Z500/g" \ 62 -e "s/QQQQ/Z400/g" \ 63 -e "s/QQQ/Z300/g" \ 64 -e "s/QQ/Z200/g" \ 65 -e "s/Q/Z100/g" \ 66 -e "s/000Z//g" \ 67 -e "s/$z10/Q/g" \ 68 -e "s/QQQQQQQQQ/Z90/g" \ 69 -e "s/QQQQQQQQ/Z80/g" \ 70 -e "s/QQQQQQQ/Z70/g" \ 71 -e "s/QQQQQQ/Z60/g" \ 72 -e "s/QQQQQ/Z50/g" \ 73 -e "s/QQQQ/Z40/g" \ 74 -e "s/QQQ/Z30/g" \ 75 -e "s/QQ/Z20/g" \ 76 -e "s/Q/Z10/g" \ 77 -e "s/00Z//g" \ 78 -e "s/z/Q/g" \ 79 -e "s/QQQQQQQQQ/Z9/g" \ 80 -e "s/QQQQQQQQ/Z8/g" \ 81 -e "s/QQQQQQQ/Z7/g" \ 82 -e "s/QQQQQQ/Z6/g" \ 83 -e "s/QQQQQ/Z5/g" \ 84 -e "s/QQQQ/Z4/g" \ 85 -e "s/QQQ/Z3/g" \ 86 -e "s/QQ/Z2/g" \ 87 -e "s/Q/Z1/g" \ 88 -e "s/0Z//g" \ 89 ; 90 } 91 92 expect_pattern () { 93 cnt="$1" 94 cat <file-a$n && 131 ( echo b && zs $n && echo ) >file-b$n && 132 ( printf c && zs $n ) >file-c$n && 133 ( echo d && zs $n ) >file-d$n && 134 135 git add file-a$n file-b$n file-c$n file-d$n && 136 137 ( zs $n && echo A ) >file-a$n && 138 ( echo B && zs $n && echo ) >file-b$n && 139 ( printf C && zs $n ) >file-c$n && 140 ( echo D && zs $n ) >file-d$n && 141 142 expect_pattern $n || return 1 143 144 done >expect 145 ' 146 147 test_expect_success 'diff -U0' ' 148 149 for n in $sample 150 do 151 git diff -U0 file-?$n || return 1 152 done | zc >actual && 153 test_cmp expect actual 154 155 ' 156 157 test_done