|
18 | 18 | file1 (fs/path root "ignored.txt") |
19 | 19 | file2 (fs/path root "not-ignored.txt")] |
20 | 20 | (testing "returns filtered files when `git ls-files` works" |
21 | | - (with-redefs [shell/sh (fn [& _args] {:exit 0 :out "not-ignored.txt"}) |
| 21 | + (with-redefs [f.index/git-ls-files #'f.index/git-ls-files* |
| 22 | + shell/sh (constantly {:exit 0 :out "not-ignored.txt"}) |
22 | 23 | fs/canonicalize #(fs/path root %)] |
23 | 24 | (is |
24 | 25 | (match? |
25 | 26 | [file2] |
26 | 27 | (f.index/filter-allowed [file1 file2] root gitignore-config))))) |
27 | 28 |
|
28 | 29 | (testing "returns all files when `git ls-files` exits non-zero" |
29 | | - (with-redefs [shell/sh (fn [& _args] {:exit 1})] |
| 30 | + (with-redefs [f.index/git-ls-files #'f.index/git-ls-files* |
| 31 | + shell/sh (constantly {:exit 1})] |
30 | 32 | (is |
31 | 33 | (match? |
32 | | - [file2] |
| 34 | + [file1 file2] |
33 | 35 | (f.index/filter-allowed [file1 file2] root gitignore-config)))))))) |
34 | 36 |
|
35 | 37 | (deftest repo-map-test |
|
50 | 52 | " baz.clj" |
51 | 53 | " foo.clj" |
52 | 54 | "") |
53 | | - (eca.features.index/repo-map {:workspace-folders [{:uri (h/file-uri "file:///fake/repo")}]} |
| 55 | + (eca.features.index/repo-map {:workspace-folders [{:uri (h/file-uri "file:///fake/repo")}]} |
54 | 56 | {:index {:repoMap {:maxEntriesPerDir 50 :maxTotalEntries 800}}} |
55 | 57 | {:as-string? true})))))) |
56 | 58 |
|
|
65 | 67 | "src/f.clj" |
66 | 68 | "src/g.clj" |
67 | 69 | "src/h.clj"])] |
68 | | - (let [out (eca.features.index/repo-map {:workspace-folders [{:uri (h/file-uri "file:///fake/repo")}]} |
| 70 | + (let [out (eca.features.index/repo-map {:workspace-folders [{:uri (h/file-uri "file:///fake/repo")}]} |
69 | 71 | {:index {:repoMap {:maxTotalEntries 800 |
70 | | - :maxEntriesPerDir 3}}} |
| 72 | + :maxEntriesPerDir 3}}} |
71 | 73 | {:as-string? true})] |
72 | 74 | (is (string/includes? out (str (h/file-path "/fake/repo") "\n"))) |
73 | 75 | ;; Under src, only first 3 children (sorted) and a per-dir truncated line should appear |
|
84 | 86 | "LICENSE" |
85 | 87 | "src/a.clj" |
86 | 88 | "src/b.clj"])] |
87 | | - (let [out (eca.features.index/repo-map {:workspace-folders [{:uri (h/file-uri "file:///fake/repo")}]} |
| 89 | + (let [out (eca.features.index/repo-map {:workspace-folders [{:uri (h/file-uri "file:///fake/repo")}]} |
88 | 90 | {:index {:repoMap {:maxTotalEntries 3 |
89 | | - :maxEntriesPerDir 800}}} |
| 91 | + :maxEntriesPerDir 800}}} |
90 | 92 | {:as-string? true})] |
91 | 93 | ;; Contains a global truncated line |
92 | 94 | (is (string/includes? out "\n... truncated output (")))))) |
0 commit comments