cli: don't crash when . is given as file pattern

This commit is contained in:
Martin von Zweigbergk 2021-09-15 22:40:15 -07:00
parent a02b5af1e8
commit e76dc5a425

View file

@ -611,7 +611,14 @@ fn matcher_from_values(
// formats)
let mut paths = HashSet::new();
for value in values {
paths.insert(ui.parse_file_path(wc_path, value)?);
let repo_path = ui.parse_file_path(wc_path, value)?;
// TODO: Remove this when we have support for directories
if repo_path.is_root() {
return Err(CommandError::UserError(
"Directory patterns are not yet supported.".to_string(),
));
}
paths.insert(repo_path);
}
Ok(Box::new(FilesMatcher::new(paths)))
} else {