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/t3010-ls-files-killed-modified.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 / t3010-ls-files-killed-modified.sh` 145 lines ยท 3435 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2005 Junio C Hamano 4 # 5 6 test_description='git ls-files -k and -m flags test. 7 8 This test prepares the following in the cache: 9 10 path0 - a file 11 path1 - a symlink 12 path2/file2 - a file in a directory 13 path3/file3 - a file in a directory 14 pathx/ju - a file in a directory 15 submod1/ - a submodule 16 submod2/ - another submodule 17 18 and the following on the filesystem: 19 20 path0/file0 - a file in a directory 21 path1/file1 - a file in a directory 22 path2 - a file 23 path3 - a symlink 24 path4 - a file 25 path5 - a symlink 26 path6/file6 - a file in a directory 27 pathx/ju/nk - a file in a directory to be killed 28 submod1/ - a submodule (modified from the cache) 29 submod2/ - a submodule (matches the cache) 30 31 git ls-files -k should report that existing filesystem objects 32 path0/*, path1/*, path2 and path3 to be killed. 33 34 Also for modification test, the cache and working tree have: 35 36 path7 - an empty file, modified to a non-empty file. 37 path8 - a non-empty file, modified to an empty file. 38 path9 - an empty file, cache dirtied. 39 path10 - a non-empty file, cache dirtied. 40 41 We should report path0, path1, path2/file2, path3/file3, path7 and path8 42 modified without reporting path9 and path10. submod1 is also modified. 43 ' 44 45 . ./test-lib.sh 46 47 test_expect_success 'git update-index --add to add various paths.' ' 48 date >path0 && 49 test_ln_s_add xyzzy path1 && 50 mkdir path2 path3 pathx && 51 date >path2/file2 && 52 date >path3/file3 && 53 >pathx/ju && 54 : >path7 && 55 date >path8 && 56 : >path9 && 57 date >path10 && 58 git update-index --add -- path0 path?/file? pathx/ju path7 path8 path9 path10 && 59 git init submod1 && 60 git -C submod1 commit --allow-empty -m "empty 1" && 61 git init submod2 && 62 git -C submod2 commit --allow-empty -m "empty 2" && 63 git update-index --add submod[12] && 64 ( 65 cd submod1 && 66 git commit --allow-empty -m "empty 1 (updated)" 67 ) && 68 rm -fr path? # leave path10 alone 69 ' 70 71 test_expect_success 'git ls-files -k to show killed files.' ' 72 date >path2 && 73 if test_have_prereq SYMLINKS 74 then 75 ln -s frotz path3 && 76 ln -s nitfol path5 77 else 78 date >path3 && 79 date >path5 80 fi && 81 mkdir -p path0 path1 path6 pathx/ju && 82 date >path0/file0 && 83 date >path1/file1 && 84 date >path6/file6 && 85 date >path7 && 86 : >path8 && 87 : >path9 && 88 touch path10 && 89 >pathx/ju/nk && 90 cat >.expected <<-\EOF 91 path0/file0 92 path1/file1 93 path2 94 path3 95 pathx/ju/nk 96 EOF 97 ' 98 99 test_expect_success 'git ls-files -k output (w/o icase)' ' 100 git ls-files -k >.output && 101 test_cmp .expected .output 102 ' 103 104 test_expect_success 'git ls-files -k output (w/ icase)' ' 105 git -c core.ignorecase=true ls-files -k >.output && 106 test_cmp .expected .output 107 ' 108 109 test_expect_success 'git ls-files -m to show modified files.' ' 110 git ls-files -m >.output 111 ' 112 113 test_expect_success 'validate git ls-files -m output.' ' 114 cat >.expected <<-\EOF && 115 path0 116 path1 117 path2/file2 118 path3/file3 119 path7 120 path8 121 pathx/ju 122 submod1 123 EOF 124 test_cmp .expected .output 125 ' 126 127 test_expect_success 'worktree modes honor wildcard pathspecs' ' 128 cat >.expected <<-\EOF && 129 path2/file2 130 path3/file3 131 EOF 132 git ls-files --deleted -- "path?/file?" >.output && 133 test_cmp .expected .output && 134 135 cat >.expected <<-\EOF && 136 path7 137 path8 138 EOF 139 git ls-files --modified --error-unmatch -- "path[78]" >.output && 140 test_cmp .expected .output && 141 142 test_must_fail git ls-files --modified --error-unmatch -- path10 143 ' 144 145 test_done