Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust tracing verbosity in list_files_git #13704

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions src/cargo/sources/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use filetime::FileTime;
use gix::bstr::{BString, ByteVec};
use gix::dir::entry::Status;
use ignore::gitignore::GitignoreBuilder;
use tracing::{trace, warn};
use tracing::{debug, trace, warn};
use walkdir::WalkDir;

/// A source represents one or multiple packages gathering from a given root
Expand Down Expand Up @@ -244,11 +244,9 @@ impl<'gctx> PathSource<'gctx> {
let repo_relative_path = match paths::strip_prefix_canonical(root, repo_root) {
Ok(p) => p,
Err(e) => {
tracing::warn!(
warn!(
"cannot determine if path `{:?}` is in git repo `{:?}`: {:?}",
root,
repo_root,
e
root, repo_root, e
);
return Ok(None);
}
Expand Down Expand Up @@ -288,11 +286,9 @@ impl<'gctx> PathSource<'gctx> {
let repo_relative_path = match paths::strip_prefix_canonical(root, repo_root) {
Ok(p) => p,
Err(e) => {
tracing::warn!(
warn!(
"cannot determine if path `{:?}` is in git repo `{:?}`: {:?}",
root,
repo_root,
e
root, repo_root, e
);
return Ok(None);
}
Expand All @@ -319,7 +315,7 @@ impl<'gctx> PathSource<'gctx> {
repo: &git2::Repository,
filter: &dyn Fn(&Path, bool) -> bool,
) -> CargoResult<Vec<PathBuf>> {
warn!("list_files_git {}", pkg.package_id());
debug!("list_files_git {}", pkg.package_id());
let index = repo.index()?;
let root = repo
.workdir()
Expand Down Expand Up @@ -407,7 +403,7 @@ impl<'gctx> PathSource<'gctx> {
Some("Cargo.toml") => {
let path = file_path.parent().unwrap();
if path != pkg_path {
warn!("subpackage found: {}", path.display());
debug!("subpackage found: {}", path.display());
ret.retain(|p| !p.starts_with(path));
subpackages_found.push(path.to_path_buf());
continue;
Expand All @@ -427,7 +423,7 @@ impl<'gctx> PathSource<'gctx> {
// symlink points to a directory.
let is_dir = is_dir.unwrap_or_else(|| file_path.is_dir());
if is_dir {
warn!(" found directory {}", file_path.display());
trace!(" found directory {}", file_path.display());
match git2::Repository::open(&file_path) {
Ok(repo) => {
let files = self.list_files_git(pkg, &repo, filter)?;
Expand All @@ -440,7 +436,7 @@ impl<'gctx> PathSource<'gctx> {
} else if filter(&file_path, is_dir) {
assert!(!is_dir);
// We found a file!
warn!(" found {}", file_path.display());
trace!(" found {}", file_path.display());
ret.push(file_path);
}
}
Expand Down Expand Up @@ -478,7 +474,7 @@ impl<'gctx> PathSource<'gctx> {
repo: &gix::Repository,
filter: &dyn Fn(&Path, bool) -> bool,
) -> CargoResult<Vec<PathBuf>> {
warn!("list_files_gix {}", pkg.package_id());
debug!("list_files_gix {}", pkg.package_id());
let options = repo
.dirwalk_options()?
.emit_untracked(gix::dir::walk::EmissionMode::Matching)
Expand Down Expand Up @@ -559,7 +555,7 @@ impl<'gctx> PathSource<'gctx> {
// our own `Cargo.toml`, we keep going.
let path = file_path.parent().unwrap();
if path != pkg_path {
warn!("subpackage found: {}", path.display());
debug!("subpackage found: {}", path.display());
files.retain(|p| !p.starts_with(path));
subpackages_found.push(path.to_path_buf());
continue;
Expand Down Expand Up @@ -595,7 +591,7 @@ impl<'gctx> PathSource<'gctx> {
}
} else if (filter)(&file_path, is_dir) {
assert!(!is_dir);
warn!(" found {}", file_path.display());
trace!(" found {}", file_path.display());
files.push(file_path);
}
}
Expand Down