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/t4073-diff-stat-name-width.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 / t4073-diff-stat-name-width.sh` 61 lines · 1772 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='git-diff check diffstat filepaths length when containing UTF-8 chars' 4 5 . ./test-lib.sh 6 7 8 create_files () { 9 mkdir -p "d你好" && 10 touch "d你好/f再见" 11 } 12 13 test_expect_success 'setup' ' 14 git init && 15 git config core.quotepath off && 16 git commit -m "Initial commit" --allow-empty && 17 create_files && 18 git add . && 19 git commit -m "Added files" 20 ' 21 22 test_expect_success 'test name-width long enough for filepath' ' 23 git diff HEAD~1 HEAD --stat --stat-name-width=12 >out && 24 test_grep "d你好/f再见 |" out && 25 git diff HEAD~1 HEAD --stat --stat-name-width=11 >out && 26 test_grep "d你好/f再见 |" out 27 ' 28 29 test_expect_success 'test name-width not long enough for dir name' ' 30 git diff HEAD~1 HEAD --stat --stat-name-width=10 >out && 31 test_grep ".../f再见 |" out && 32 git diff HEAD~1 HEAD --stat --stat-name-width=9 >out && 33 test_grep ".../f再见 |" out 34 ' 35 36 test_expect_success 'test name-width not long enough for slash' ' 37 git diff HEAD~1 HEAD --stat --stat-name-width=8 >out && 38 test_grep "...f再见 |" out 39 ' 40 41 test_expect_success 'test name-width not long enough for file name' ' 42 git diff HEAD~1 HEAD --stat --stat-name-width=7 >out && 43 test_grep "...再见 |" out && 44 git diff HEAD~1 HEAD --stat --stat-name-width=6 >out && 45 test_grep "...见 |" out && 46 git diff HEAD~1 HEAD --stat --stat-name-width=5 >out && 47 test_grep "...见 |" out && 48 git diff HEAD~1 HEAD --stat --stat-name-width=4 >out && 49 test_grep "... |" out 50 ' 51 52 test_expect_success 'test name-width minimum length' ' 53 git diff HEAD~1 HEAD --stat --stat-name-width=3 >out && 54 test_grep "... |" out && 55 git diff HEAD~1 HEAD --stat --stat-name-width=2 >out && 56 test_grep "... |" out && 57 git diff HEAD~1 HEAD --stat --stat-name-width=1 >out && 58 test_grep "... |" out 59 ' 60 61 test_done