- remove (probably) unnecessary unix path conversion - some more clarity with bstr conversions and the prefix check
Unified · Split
| @@ -137,15 +137,14 @@ fn gitdir_matches( · 136 unmodified lines | |||
| 137 | if is_relative { | 137 | if is_relative { |
| 138 | if let Some(parent_path) = target_config_path.and_then(|p| p.parent()) { | 138 | if let Some(parent_path) = target_config_path.and_then(|p| p.parent()) { |
| 139 | let parent_dir = git_path::into_bstr(parent_path); | 139 | let parent_dir = git_path::into_bstr(parent_path); |
| 140 | let v = bstr::concat(&[parent_dir.as_bstr(), pattern_path[DOT.len()..].as_bstr()]); | 140 | pattern_path = bstr::concat(&[&parent_dir, &pattern_path[DOT.len()..]]).into(); |
| 141 | pattern_path = git_path::to_unix_separators(Cow::Owned(v.into())).into_owned(); | ||
| 142 | } | 141 | } |
| 143 | } | 142 | } |
| 144 | if !["~/", "./", "/"] | 143 | if ["~/", "./", "/"] |
| 145 | .iter() | 144 | .iter() |
| 146 | .any(|prefix| pattern_path.starts_with(prefix.as_bytes())) | 145 | .all(|prefix| !pattern_path.starts_with(prefix.as_bytes())) |
| 147 | { | 146 | { |
| 148 | let v = bstr::concat(&["**/".as_bytes().as_bstr(), pattern_path.as_bstr()]); | 147 | let v = bstr::concat(&[&b"**/"[..], &pattern_path]); |
| 149 | pattern_path = BString::from(v); | 148 | pattern_path = BString::from(v); |
| 150 | } | 149 | } |
| 151 | if pattern_path.ends_with(b"/") { | 150 | if pattern_path.ends_with(b"/") { |