You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe they do nothing in grcov and are superfluous.
Here's how I arrive at that conclusion
I've added some debug logging to grcov and investigated how globset works and AFAICT --ignore "/*" would would ignore files that have an absolute path that begins with a / and --ignore "../*" would ignore any explicitly relative paths that begin with ../.
if let Some(p) = &source_dir {
assert!(p.is_absolute());
}
// Traverse source dir and store all paths, reversed.
let mut file_to_paths: FxHashMap<String, Vec<PathBuf>> = FxHashMap::default();
if let Some(ref source_dir) = source_dir {
for entry in WalkDir::new(&source_dir)
.into_iter()
.filter_entry(|e| !is_hidden(e) && !is_symbolic_link(e))
{
let entry = entry
.unwrap_or_else(|_| panic!("Failed to open directory '{}'.", source_dir.display()));
let full_path = entry.path();
if !full_path.is_file() {
continue;
}
let path = full_path.strip_prefix(&source_dir).unwrap().to_path_buf();
if to_ignore_globset.is_match(&path) {
continue;
}
let name = entry.file_name().to_str().unwrap().to_string();
match file_to_paths.entry(name) {
hash_map::Entry::Occupied(f) => f.into_mut().push(path),
hash_map::Entry::Vacant(v) => {
v.insert(vec![path]);
}
};
}
}
As can be seen, full_path always begins with / and path never begins with / or ../ but instead is always
relative to source_dir. To me, that means that "/" and "../" will never match path and are therefore superfluous.
The text was updated successfully, but these errors were encountered:
winksaville
changed the title
Are /* and ../* ignore options functional?
Are /* and ../* ignore options useful?
Aug 21, 2022
@winksaville I'm stunned that I missed this comment!
Sorry for that, looks like you did quite a research
I'd be happy to accept a PR that fixes this
Again -- apologies for missing it
What do ignore "/" and "../" do?
xtaskops/xtaskops/src/tasks.rs
Lines 69 to 72 in 51f458f
I believe they do nothing in grcov and are superfluous.
Here's how I arrive at that conclusion
I've added some debug logging to grcov and investigated how globset works and AFAICT
--ignore "/*"
would would ignore files that have an absolute path that begins with a/
and--ignore "../*"
would ignore any explicitly relative paths that begin with../
.After looking at the original code in
fn rewrite_paths
:I added some debug logging to print the
full_path
andpath
:And here is some output where `--ignore "xtask/*" is processed:
As can be seen,
full_path
always begins with/
andpath
never begins with/
or../
but instead is alwaysrelative to
source_dir
. To me, that means that "/" and "../" will never matchpath
and are therefore superfluous.The text was updated successfully, but these errors were encountered: