@@ -103,44 +103,24 @@ pub(crate) mod function {
103
103
continue ;
104
104
}
105
105
106
- pruned_entries += usize:: from ( entry. pathspec_match . is_none ( ) ) ;
107
- if entry. status . is_pruned ( ) || entry. pathspec_match . is_none ( ) {
108
- continue ;
109
- }
110
- let mut disk_kind = entry. disk_kind . expect ( "present if not pruned" ) ;
111
- match disk_kind {
112
- Kind :: File | Kind :: Symlink => { }
113
- Kind :: EmptyDirectory | Kind :: Directory | Kind :: Repository => {
114
- let keep = directories
115
- || entry
116
- . pathspec_match
117
- . map_or ( false , |m| m != gix:: dir:: entry:: PathspecMatch :: Always ) ;
118
- if !keep {
119
- skipped_directories += 1 ;
120
- if debug {
121
- writeln ! ( err, "DBG: prune '{}' as -d is missing" , entry. rela_path) . ok ( ) ;
122
- }
123
- continue ;
124
- }
125
- }
126
- } ;
127
-
128
- let keep = entry
106
+ let pathspec_includes_entry = entry
129
107
. pathspec_match
130
- . map_or ( true , |m| m != gix:: dir:: entry:: PathspecMatch :: Excluded ) ;
131
- if !keep {
132
- if debug {
133
- writeln ! ( err, "DBG: prune '{}' as it is excluded by pathspec" , entry. rela_path) . ok ( ) ;
134
- }
108
+ . map_or ( false , |m| m != gix:: dir:: entry:: PathspecMatch :: Excluded ) ;
109
+ pruned_entries += usize:: from ( !pathspec_includes_entry) ;
110
+ if !pathspec_includes_entry && debug {
111
+ writeln ! ( err, "DBG: prune '{}' as it is excluded by pathspec" , entry. rela_path) . ok ( ) ;
112
+ }
113
+ if entry. status . is_pruned ( ) || !pathspec_includes_entry {
135
114
continue ;
136
115
}
137
116
117
+ let mut disk_kind = entry. disk_kind . expect ( "present if not pruned" ) ;
138
118
let keep = match entry. status {
139
119
Status :: DotGit | Status :: Pruned | Status :: TrackedExcluded => {
140
- unreachable ! ( "Pruned aren't emitted " )
120
+ unreachable ! ( "BUG: Pruned are skipped already as their pathspec is always None " )
141
121
}
142
122
Status :: Tracked => {
143
- unreachable ! ( "tracked aren't emitted" )
123
+ unreachable ! ( "BUG: tracked aren't emitted" )
144
124
}
145
125
Status :: Ignored ( gix:: ignore:: Kind :: Expendable ) => {
146
126
skipped_ignored += usize:: from ( !ignored) ;
@@ -168,18 +148,30 @@ pub(crate) mod function {
168
148
disk_kind = gix:: dir:: entry:: Kind :: Repository ;
169
149
}
170
150
171
- let is_ignored = matches ! ( entry. status, gix:: dir:: entry:: Status :: Ignored ( _) ) ;
172
- let display_path = entry. rela_path [ prefix_len..] . as_bstr ( ) ;
173
- if ( !repositories || is_ignored) && disk_kind == gix:: dir:: entry:: Kind :: Repository {
174
- if !is_ignored {
175
- skipped_repositories += 1 ;
151
+ match disk_kind {
152
+ Kind :: File | Kind :: Symlink => { }
153
+ Kind :: EmptyDirectory | Kind :: Directory => {
154
+ if !directories {
155
+ skipped_directories += 1 ;
156
+ if debug {
157
+ writeln ! ( err, "DBG: prune '{}' as -d is missing" , entry. rela_path) . ok ( ) ;
158
+ }
159
+ continue ;
160
+ }
176
161
}
177
- if debug {
178
- writeln ! ( err, "DBG: skipped repository at '{display_path}'" ) ?;
162
+ Kind :: Repository => {
163
+ if !repositories {
164
+ skipped_repositories += 1 ;
165
+ if debug {
166
+ writeln ! ( err, "DBG: skipped repository at '{}'" , entry. rela_path) ?;
167
+ }
168
+ continue ;
169
+ }
179
170
}
180
- continue ;
181
- }
171
+ } ;
182
172
173
+ let is_ignored = matches ! ( entry. status, gix:: dir:: entry:: Status :: Ignored ( _) ) ;
174
+ let display_path = entry. rela_path [ prefix_len..] . as_bstr ( ) ;
183
175
if disk_kind == gix:: dir:: entry:: Kind :: Directory {
184
176
saw_ignored_directory |= is_ignored;
185
177
saw_untracked_directory |= entry. status == gix:: dir:: entry:: Status :: Untracked ;
@@ -194,8 +186,8 @@ pub(crate) mod function {
194
186
Cow :: Owned ( format!(
195
187
"({})" ,
196
188
match kind {
197
- gix:: ignore:: Kind :: Precious => "$ " ,
198
- gix:: ignore:: Kind :: Expendable => "❌ " ,
189
+ gix:: ignore:: Kind :: Precious => "💲 " ,
190
+ gix:: ignore:: Kind :: Expendable => "🗑️ " ,
199
191
}
200
192
) )
201
193
}
@@ -210,10 +202,16 @@ pub(crate) mod function {
210
202
} ,
211
203
} ,
212
204
maybe = if execute { "removing" } else { "WOULD remove" } ,
213
- suffix = if disk_kind == gix:: dir:: entry:: Kind :: Repository {
214
- " repository"
215
- } else {
216
- ""
205
+ suffix = match disk_kind {
206
+ Kind :: File | Kind :: Symlink | Kind :: Directory => {
207
+ ""
208
+ }
209
+ Kind :: EmptyDirectory => {
210
+ " empty"
211
+ }
212
+ Kind :: Repository => {
213
+ " repository"
214
+ }
217
215
} ,
218
216
) ?;
219
217
0 commit comments