Unified · Split
| @@ -145,21 +145,18 @@ impl State { · 144 unmodified lines | ||
| 145 | 145 | .rfind_byte(b'/') |
| 146 | 146 | .map(|pos| path[pos + 1..].as_bstr()) |
| 147 | 147 | .unwrap_or(path); |
| 148 | − for (desired, is_ignore) in names { | |
| 149 | − let is_match = match case { | |
| 150 | − Case::Sensitive => basename == *desired, | |
| 151 | − Case::Fold => basename.eq_ignore_ascii_case(desired), | |
| 152 | − }; | |
| 153 | − if !is_match { | |
| 154 | − continue; | |
| 155 | − }; | |
| 156 | − // See https://github.com/git/git/blob/master/dir.c#L912:L912 | |
| 157 | − if *is_ignore && !entry.flags.contains(git_index::entry::Flags::SKIP_WORKTREE) { | |
| 158 | − return None; | |
| 148 | + let is_ignore = names.iter().find_map(|t| { | |
| 149 | + match case { | |
| 150 | + Case::Sensitive => basename == t.0, | |
| 151 | + Case::Fold => basename.eq_ignore_ascii_case(t.0), | |
| 159 | 152 | } |
| 160 | − return Some((path, entry.id)); | |
| 153 | + .then(|| t.1) | |
| 154 | + })?; | |
| 155 | + // See https://github.com/git/git/blob/master/dir.c#L912:L912 | |
| 156 | + if is_ignore && !entry.flags.contains(git_index::entry::Flags::SKIP_WORKTREE) { | |
| 157 | + return None; | |
| 161 | 158 | } |
| 162 | − None | |
| 159 | + Some((path, entry.id)) | |
| 163 | 160 | } else { |
| 164 | 161 | None |
| 165 | 162 | } |