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/t4035-diff-quiet.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 / t4035-diff-quiet.sh` 168 lines ยท 5171 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='Return value of diffs' 4 5 . ./test-lib.sh 6 7 test_expect_success 'setup' ' 8 echo 1 >a && 9 git add . && 10 git commit -m first && 11 echo 2 >b && 12 git add . && 13 git commit -a -m second && 14 mkdir -p test-outside/repo && ( 15 cd test-outside/repo && 16 git init && 17 echo "1 1" >a && 18 git add . && 19 git commit -m 1 20 ) && 21 mkdir -p test-outside/non/git && ( 22 cd test-outside/non/git && 23 echo "1 1" >a && 24 echo "1 1" >matching-file && 25 echo "1 1 " >trailing-space && 26 echo "1 1" >extra-space && 27 echo "2" >never-match 28 ) 29 ' 30 31 test_expect_success 'git diff-tree HEAD^ HEAD' ' 32 test_expect_code 1 git diff-tree --quiet HEAD^ HEAD >cnt && 33 test_line_count = 0 cnt 34 ' 35 test_expect_success 'git diff-tree HEAD^ HEAD -- a' ' 36 test_expect_code 0 git diff-tree --quiet HEAD^ HEAD -- a >cnt && 37 test_line_count = 0 cnt 38 ' 39 test_expect_success 'git diff-tree HEAD^ HEAD -- b' ' 40 test_expect_code 1 git diff-tree --quiet HEAD^ HEAD -- b >cnt && 41 test_line_count = 0 cnt 42 ' 43 # this diff outputs one line: sha1 of the given head 44 test_expect_success 'echo HEAD | git diff-tree --stdin' ' 45 echo $(git rev-parse HEAD) | 46 test_expect_code 1 git diff-tree --quiet --stdin >cnt && 47 test_line_count = 1 cnt 48 ' 49 test_expect_success 'git diff-tree HEAD HEAD' ' 50 test_expect_code 0 git diff-tree --quiet HEAD HEAD >cnt && 51 test_line_count = 0 cnt 52 ' 53 test_expect_success 'git diff-tree -w HEAD^ HEAD' ' 54 test_expect_code 1 git diff-tree --quiet -w HEAD^ HEAD >cnt && 55 test_line_count = 0 cnt 56 ' 57 test_expect_success 'git diff-files' ' 58 test_expect_code 0 git diff-files --quiet >cnt && 59 test_line_count = 0 cnt 60 ' 61 test_expect_success 'git diff-index --cached HEAD' ' 62 test_expect_code 0 git diff-index --quiet --cached HEAD >cnt && 63 test_line_count = 0 cnt 64 ' 65 test_expect_success 'git diff-index --cached HEAD^' ' 66 test_expect_code 1 git diff-index --quiet --cached HEAD^ >cnt && 67 test_line_count = 0 cnt 68 ' 69 test_expect_success 'git diff-index --cached HEAD^' ' 70 echo text >>b && 71 echo 3 >c && 72 git add . && 73 test_expect_code 1 git diff-index --quiet --cached HEAD^ >cnt && 74 test_line_count = 0 cnt 75 ' 76 test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' ' 77 git commit -m "text in b" && 78 test_expect_code 1 git diff-tree --quiet -Stext HEAD^ HEAD -- b >cnt && 79 test_line_count = 0 cnt 80 ' 81 test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' ' 82 test_expect_code 0 git diff-tree --quiet -Snot-found HEAD^ HEAD -- b >cnt && 83 test_line_count = 0 cnt 84 ' 85 test_expect_success 'git diff-files' ' 86 echo 3 >>c && 87 test_expect_code 1 git diff-files --quiet >cnt && 88 test_line_count = 0 cnt 89 ' 90 91 test_expect_success 'git diff-index --cached HEAD' ' 92 git update-index c && 93 test_expect_code 1 git diff-index --quiet --cached HEAD >cnt && 94 test_line_count = 0 cnt 95 ' 96 97 test_expect_success 'git diff, one file outside repo' ' 98 ( 99 cd test-outside/repo && 100 test_expect_code 0 git diff --quiet a ../non/git/matching-file && 101 test_expect_code 1 git diff --quiet a ../non/git/extra-space 102 ) 103 ' 104 105 test_expect_success 'git diff, both files outside repo' ' 106 ( 107 GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/test-outside" && 108 export GIT_CEILING_DIRECTORIES && 109 cd test-outside/non/git && 110 test_expect_code 0 git diff --quiet a matching-file && 111 test_expect_code 1 git diff --quiet a extra-space 112 ) 113 ' 114 115 test_expect_success 'git diff --ignore-space-at-eol, one file outside repo' ' 116 ( 117 cd test-outside/repo && 118 test_expect_code 0 git diff --quiet --ignore-space-at-eol a ../non/git/trailing-space && 119 test_expect_code 1 git diff --quiet --ignore-space-at-eol a ../non/git/extra-space 120 ) 121 ' 122 123 test_expect_success 'git diff --ignore-space-at-eol, both files outside repo' ' 124 ( 125 GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/test-outside" && 126 export GIT_CEILING_DIRECTORIES && 127 cd test-outside/non/git && 128 test_expect_code 0 git diff --quiet --ignore-space-at-eol a trailing-space && 129 test_expect_code 1 git diff --quiet --ignore-space-at-eol a extra-space 130 ) 131 ' 132 133 test_expect_success 'git diff --ignore-all-space, one file outside repo' ' 134 ( 135 cd test-outside/repo && 136 test_expect_code 0 git diff --quiet --ignore-all-space a ../non/git/trailing-space && 137 test_expect_code 0 git diff --quiet --ignore-all-space a ../non/git/extra-space && 138 test_expect_code 1 git diff --quiet --ignore-all-space a ../non/git/never-match 139 ) 140 ' 141 142 test_expect_success 'git diff --ignore-all-space, both files outside repo' ' 143 ( 144 GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/test-outside" && 145 export GIT_CEILING_DIRECTORIES && 146 cd test-outside/non/git && 147 test_expect_code 0 git diff --quiet --ignore-all-space a trailing-space && 148 test_expect_code 0 git diff --quiet --ignore-all-space a extra-space && 149 test_expect_code 1 git diff --quiet --ignore-all-space a never-match 150 ) 151 ' 152 153 test_expect_success 'git diff --quiet ignores stat-change only entries' ' 154 test-tool chmtime +10 a && 155 echo modified >>b && 156 test_expect_code 1 git diff --quiet 157 ' 158 159 test_expect_success 'git diff --quiet on a path that need conversion' ' 160 echo "crlf.txt text=auto" >.gitattributes && 161 printf "Hello\r\nWorld\r\n" >crlf.txt && 162 git add .gitattributes crlf.txt && 163 164 printf "Hello\r\nWorld\n" >crlf.txt && 165 git diff --quiet crlf.txt 166 ' 167 168 test_done