History

refactor

- remove (probably) unnecessary unix path conversion - some more clarity with bstr conversions and the prefix check

Sebastian Thiel committed 4 years ago

Commit e1ba36f1 parent 315c87e1 file · +4 −5Browse files

Unified · Split

git-config/src/file/resolve_includes.rs+4−5
@@ -137,15 +137,14 @@ fn gitdir_matches( · 136 unmodified lines
137137 if is_relative {
138138 if let Some(parent_path) = target_config_path.and_then(|p| p.parent()) {
139139 let parent_dir = git_path::into_bstr(parent_path);
140− let v = bstr::concat(&[parent_dir.as_bstr(), pattern_path[DOT.len()..].as_bstr()]);
141− pattern_path = git_path::to_unix_separators(Cow::Owned(v.into())).into_owned();
140+ pattern_path = bstr::concat(&[&parent_dir, &pattern_path[DOT.len()..]]).into();
142141 }
143142 }
144− if !["~/", "./", "/"]
143+ if ["~/", "./", "/"]
145144 .iter()
146− .any(|prefix| pattern_path.starts_with(prefix.as_bytes()))
145+ .all(|prefix| !pattern_path.starts_with(prefix.as_bytes()))
147146 {
148− let v = bstr::concat(&["**/".as_bytes().as_bstr(), pattern_path.as_bstr()]);
147+ let v = bstr::concat(&[&b"**/"[..], &pattern_path]);
149148 pattern_path = BString::from(v);
150149 }
151150 if pattern_path.ends_with(b"/") {