Skip to content

Commit db6a42b

Browse files
committed
fix: adjust tracing verbosity in list_files_git
1 parent 4113935 commit db6a42b

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

Diff for: src/cargo/sources/path.rs

+12-16
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use filetime::FileTime;
1616
use gix::bstr::{BString, ByteVec};
1717
use gix::dir::entry::Status;
1818
use ignore::gitignore::GitignoreBuilder;
19-
use tracing::{trace, warn};
19+
use tracing::{debug, trace, warn};
2020
use walkdir::WalkDir;
2121

2222
/// A source represents one or multiple packages gathering from a given root
@@ -244,11 +244,9 @@ impl<'gctx> PathSource<'gctx> {
244244
let repo_relative_path = match paths::strip_prefix_canonical(root, repo_root) {
245245
Ok(p) => p,
246246
Err(e) => {
247-
tracing::warn!(
247+
warn!(
248248
"cannot determine if path `{:?}` is in git repo `{:?}`: {:?}",
249-
root,
250-
repo_root,
251-
e
249+
root, repo_root, e
252250
);
253251
return Ok(None);
254252
}
@@ -288,11 +286,9 @@ impl<'gctx> PathSource<'gctx> {
288286
let repo_relative_path = match paths::strip_prefix_canonical(root, repo_root) {
289287
Ok(p) => p,
290288
Err(e) => {
291-
tracing::warn!(
289+
warn!(
292290
"cannot determine if path `{:?}` is in git repo `{:?}`: {:?}",
293-
root,
294-
repo_root,
295-
e
291+
root, repo_root, e
296292
);
297293
return Ok(None);
298294
}
@@ -319,7 +315,7 @@ impl<'gctx> PathSource<'gctx> {
319315
repo: &git2::Repository,
320316
filter: &dyn Fn(&Path, bool) -> bool,
321317
) -> CargoResult<Vec<PathBuf>> {
322-
warn!("list_files_git {}", pkg.package_id());
318+
debug!("list_files_git {}", pkg.package_id());
323319
let index = repo.index()?;
324320
let root = repo
325321
.workdir()
@@ -407,7 +403,7 @@ impl<'gctx> PathSource<'gctx> {
407403
Some("Cargo.toml") => {
408404
let path = file_path.parent().unwrap();
409405
if path != pkg_path {
410-
warn!("subpackage found: {}", path.display());
406+
debug!("subpackage found: {}", path.display());
411407
ret.retain(|p| !p.starts_with(path));
412408
subpackages_found.push(path.to_path_buf());
413409
continue;
@@ -427,7 +423,7 @@ impl<'gctx> PathSource<'gctx> {
427423
// symlink points to a directory.
428424
let is_dir = is_dir.unwrap_or_else(|| file_path.is_dir());
429425
if is_dir {
430-
warn!(" found directory {}", file_path.display());
426+
trace!(" found directory {}", file_path.display());
431427
match git2::Repository::open(&file_path) {
432428
Ok(repo) => {
433429
let files = self.list_files_git(pkg, &repo, filter)?;
@@ -440,7 +436,7 @@ impl<'gctx> PathSource<'gctx> {
440436
} else if filter(&file_path, is_dir) {
441437
assert!(!is_dir);
442438
// We found a file!
443-
warn!(" found {}", file_path.display());
439+
trace!(" found {}", file_path.display());
444440
ret.push(file_path);
445441
}
446442
}
@@ -478,7 +474,7 @@ impl<'gctx> PathSource<'gctx> {
478474
repo: &gix::Repository,
479475
filter: &dyn Fn(&Path, bool) -> bool,
480476
) -> CargoResult<Vec<PathBuf>> {
481-
warn!("list_files_gix {}", pkg.package_id());
477+
debug!("list_files_gix {}", pkg.package_id());
482478
let options = repo
483479
.dirwalk_options()?
484480
.emit_untracked(gix::dir::walk::EmissionMode::Matching)
@@ -559,7 +555,7 @@ impl<'gctx> PathSource<'gctx> {
559555
// our own `Cargo.toml`, we keep going.
560556
let path = file_path.parent().unwrap();
561557
if path != pkg_path {
562-
warn!("subpackage found: {}", path.display());
558+
debug!("subpackage found: {}", path.display());
563559
files.retain(|p| !p.starts_with(path));
564560
subpackages_found.push(path.to_path_buf());
565561
continue;
@@ -595,7 +591,7 @@ impl<'gctx> PathSource<'gctx> {
595591
}
596592
} else if (filter)(&file_path, is_dir) {
597593
assert!(!is_dir);
598-
warn!(" found {}", file_path.display());
594+
trace!(" found {}", file_path.display());
599595
files.push(file_path);
600596
}
601597
}

0 commit comments

Comments
 (0)