| @@ -2093,6 +2093,70 @@ fn root_can_be_pruned_early_with_pathspec() -> crate::Result { · 2092 unmodified lines |
| 2093 | 2093 | Ok(()) |
| 2094 | 2094 | } |
| 2095 | 2095 | |
| 2096 | +#[test] |
| 2097 | +fn submodules() -> crate::Result { |
| 2098 | + let root = fixture("multiple-submodules"); |
| 2099 | + let (out, entries) = collect(&root, |keep, ctx| walk(&root, &root, ctx, options_emit_all(), keep)); |
| 2100 | + assert_eq!( |
| 2101 | + out, |
| 2102 | + walk::Outcome { |
| 2103 | + read_dir_calls: 2, |
| 2104 | + returned_entries: entries.len(), |
| 2105 | + seen_entries: 5, |
| 2106 | + } |
| 2107 | + ); |
| 2108 | + let expected_content = [ |
| 2109 | + entry_nokind(".git", DotGit), |
| 2110 | + entry(".gitmodules", Tracked, File).with_index_kind(File), |
| 2111 | + entry("a/b", Tracked, Repository).with_index_kind(Repository), |
| 2112 | + entry("empty", Tracked, File).with_index_kind(File), |
| 2113 | + entry("submodule", Tracked, Repository).with_index_kind(Repository), |
| 2114 | + ]; |
| 2115 | + assert_eq!(entries, expected_content, "submodules are detected as repositories"); |
| 2116 | + |
| 2117 | + let (out1, entries) = try_collect_filtered_opts_collect( |
| 2118 | + &root, |
| 2119 | + |keep, ctx| walk(&root, &root, ctx, options_emit_all(), keep), |
| 2120 | + None::<&str>, |
| 2121 | + Options { |
| 2122 | + fresh_index: false, |
| 2123 | + ..Default::default() |
| 2124 | + }, |
| 2125 | + )?; |
| 2126 | + assert_eq!(out1, out, "the output matches precisely"); |
| 2127 | + assert_eq!( |
| 2128 | + entries, expected_content, |
| 2129 | + "this is also the case if the index isn't considered fresh" |
| 2130 | + ); |
| 2131 | + |
| 2132 | + let (out2, entries) = try_collect_filtered_opts_collect( |
| 2133 | + &root, |
| 2134 | + |keep, ctx| { |
| 2135 | + walk( |
| 2136 | + &root, |
| 2137 | + &root, |
| 2138 | + ctx, |
| 2139 | + walk::Options { |
| 2140 | + ignore_case: true, |
| 2141 | + ..options_emit_all() |
| 2142 | + }, |
| 2143 | + keep, |
| 2144 | + ) |
| 2145 | + }, |
| 2146 | + None::<&str>, |
| 2147 | + Options { |
| 2148 | + fresh_index: false, |
| 2149 | + ..Default::default() |
| 2150 | + }, |
| 2151 | + )?; |
| 2152 | + assert_eq!(out2, out, "the output matches precisely, even with ignore-case"); |
| 2153 | + assert_eq!( |
| 2154 | + entries, expected_content, |
| 2155 | + "ignore case doesn't change anything (even though our search is quite different)" |
| 2156 | + ); |
| 2157 | + Ok(()) |
| 2158 | +} |
| 2159 | + |
| 2096 | 2160 | #[test] |
| 2097 | 2161 | fn cancel_with_collection_does_not_fail() -> crate::Result { |
| 2098 | 2162 | struct CancelDelegate { |
| @@ -2105,7 +2169,6 @@ fn cancel_with_collection_does_not_fail() -> crate::Result { · 6 unmodified lines |
| 2105 | 2169 | walk::Action::Cancel |
| 2106 | 2170 | } else { |
| 2107 | 2171 | self.emits_left_until_cancel -= 1; |
| 2108 | | − dbg!(self.emits_left_until_cancel); |
| 2109 | 2172 | walk::Action::Continue |
| 2110 | 2173 | } |
| 2111 | 2174 | } |