Skip to content
Myr

refactor: Rename cwd as full_path_base

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Because I think it makes it's intention more clear.

authored by Thayne McCombs · committed by Thayne McCombs · parent cd4fd03 · Browse files · 3 files+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+4 added−4 removed

  • other:+4 added−4 removed

3 files+4 added−4 removed

modified:src/config.rs+1 added-1 removed
15 unmodified lines
16 pub case_sensitive: bool,1718 /// Cached current working directory for absolute path construction.19 /// Populated when `--full-path` is set; `None` means search by filename only.20 pub cwd: Option<PathBuf>,20 pub full_path_base: Option<PathBuf>,2122 /// Whether to ignore hidden files and directories (or not).23 pub ignore_hidden: bool,24
119 unmodified lines
modified:src/main.rs+2 added-2 removed
243 unmodified lines
244 };245 let command = extract_command(&mut opts, colored_output)?;246 let has_command = command.is_some();247248 let cwd = if opts.full_path {248 let full_path_base = if opts.full_path {249 Some(env::current_dir().context(250 "Could not determine current directory. \251 This is required for --full-path.",252 )?)
2 unmodified lines
255 };256257 Ok(Config {258 case_sensitive,259 cwd,259 full_path_base,260 ignore_hidden: !(opts.hidden || opts.rg_alias_ignore()),261 read_fdignore: !(opts.no_ignore || opts.rg_alias_ignore()),262 read_vcsignore: !(opts.no_ignore || opts.rg_alias_ignore() || opts.no_ignore_vcs),263 require_git_to_read_vcsignore: !opts.no_require_git,
238 unmodified lines
modified:src/walk.rs+1 added-1 removed
522 unmodified lines
523524 // Check the name first, since it doesn't require metadata525 let entry_path = entry.path();526527 let search_str = search_str_for_entry(entry_path, config.cwd.as_deref());527 let search_str = search_str_for_entry(entry_path, config.full_path_base.as_deref());528529 if !patterns530 .iter()531 .all(|pat| pat.is_match(&filesystem::osstr_to_bytes(search_str.as_ref())))
207 unmodified lines