Unified · Split
| @@ -145,21 +145,18 @@ impl State { · 144 unmodified lines | |||
| 145 | .rfind_byte(b'/') | 145 | .rfind_byte(b'/') |
| 146 | .map(|pos| path[pos + 1..].as_bstr()) | 146 | .map(|pos| path[pos + 1..].as_bstr()) |
| 147 | .unwrap_or(path); | 147 | .unwrap_or(path); |
| 148 | for (desired, is_ignore) in names { | 148 | let is_ignore = names.iter().find_map(|t| { |
| 149 | let is_match = match case { | 149 | match case { |
| 150 | Case::Sensitive => basename == *desired, | 150 | Case::Sensitive => basename == t.0, |
| 151 | Case::Fold => basename.eq_ignore_ascii_case(desired), | 151 | Case::Fold => basename.eq_ignore_ascii_case(t.0), |
| 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; | ||
| 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 | } else { | 160 | } else { |
| 164 | None | 161 | None |
| 165 | } | 162 | } |