mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Auto merge of #13704 - arlosi:path-tracing, r=epage
fix: adjust tracing verbosity in list_files_git Verbosity was set to `warn` for items that did not justify it.
This commit is contained in:
commit
6bb0ba15b9
@ -16,7 +16,7 @@ use filetime::FileTime;
|
|||||||
use gix::bstr::{BString, ByteVec};
|
use gix::bstr::{BString, ByteVec};
|
||||||
use gix::dir::entry::Status;
|
use gix::dir::entry::Status;
|
||||||
use ignore::gitignore::GitignoreBuilder;
|
use ignore::gitignore::GitignoreBuilder;
|
||||||
use tracing::{trace, warn};
|
use tracing::{debug, trace, warn};
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
/// A source represents one or multiple packages gathering from a given root
|
/// A source represents one or multiple packages gathering from a given root
|
||||||
@ -244,11 +244,9 @@ impl<'gctx> PathSource<'gctx> {
|
|||||||
let repo_relative_path = match paths::strip_prefix_canonical(root, repo_root) {
|
let repo_relative_path = match paths::strip_prefix_canonical(root, repo_root) {
|
||||||
Ok(p) => p,
|
Ok(p) => p,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::warn!(
|
warn!(
|
||||||
"cannot determine if path `{:?}` is in git repo `{:?}`: {:?}",
|
"cannot determine if path `{:?}` is in git repo `{:?}`: {:?}",
|
||||||
root,
|
root, repo_root, e
|
||||||
repo_root,
|
|
||||||
e
|
|
||||||
);
|
);
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
@ -288,11 +286,9 @@ impl<'gctx> PathSource<'gctx> {
|
|||||||
let repo_relative_path = match paths::strip_prefix_canonical(root, repo_root) {
|
let repo_relative_path = match paths::strip_prefix_canonical(root, repo_root) {
|
||||||
Ok(p) => p,
|
Ok(p) => p,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::warn!(
|
warn!(
|
||||||
"cannot determine if path `{:?}` is in git repo `{:?}`: {:?}",
|
"cannot determine if path `{:?}` is in git repo `{:?}`: {:?}",
|
||||||
root,
|
root, repo_root, e
|
||||||
repo_root,
|
|
||||||
e
|
|
||||||
);
|
);
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
@ -319,7 +315,7 @@ impl<'gctx> PathSource<'gctx> {
|
|||||||
repo: &git2::Repository,
|
repo: &git2::Repository,
|
||||||
filter: &dyn Fn(&Path, bool) -> bool,
|
filter: &dyn Fn(&Path, bool) -> bool,
|
||||||
) -> CargoResult<Vec<PathBuf>> {
|
) -> CargoResult<Vec<PathBuf>> {
|
||||||
warn!("list_files_git {}", pkg.package_id());
|
debug!("list_files_git {}", pkg.package_id());
|
||||||
let index = repo.index()?;
|
let index = repo.index()?;
|
||||||
let root = repo
|
let root = repo
|
||||||
.workdir()
|
.workdir()
|
||||||
@ -407,7 +403,7 @@ impl<'gctx> PathSource<'gctx> {
|
|||||||
Some("Cargo.toml") => {
|
Some("Cargo.toml") => {
|
||||||
let path = file_path.parent().unwrap();
|
let path = file_path.parent().unwrap();
|
||||||
if path != pkg_path {
|
if path != pkg_path {
|
||||||
warn!("subpackage found: {}", path.display());
|
debug!("subpackage found: {}", path.display());
|
||||||
ret.retain(|p| !p.starts_with(path));
|
ret.retain(|p| !p.starts_with(path));
|
||||||
subpackages_found.push(path.to_path_buf());
|
subpackages_found.push(path.to_path_buf());
|
||||||
continue;
|
continue;
|
||||||
@ -427,7 +423,7 @@ impl<'gctx> PathSource<'gctx> {
|
|||||||
// symlink points to a directory.
|
// symlink points to a directory.
|
||||||
let is_dir = is_dir.unwrap_or_else(|| file_path.is_dir());
|
let is_dir = is_dir.unwrap_or_else(|| file_path.is_dir());
|
||||||
if is_dir {
|
if is_dir {
|
||||||
warn!(" found directory {}", file_path.display());
|
trace!(" found directory {}", file_path.display());
|
||||||
match git2::Repository::open(&file_path) {
|
match git2::Repository::open(&file_path) {
|
||||||
Ok(repo) => {
|
Ok(repo) => {
|
||||||
let files = self.list_files_git(pkg, &repo, filter)?;
|
let files = self.list_files_git(pkg, &repo, filter)?;
|
||||||
@ -440,7 +436,7 @@ impl<'gctx> PathSource<'gctx> {
|
|||||||
} else if filter(&file_path, is_dir) {
|
} else if filter(&file_path, is_dir) {
|
||||||
assert!(!is_dir);
|
assert!(!is_dir);
|
||||||
// We found a file!
|
// We found a file!
|
||||||
warn!(" found {}", file_path.display());
|
trace!(" found {}", file_path.display());
|
||||||
ret.push(file_path);
|
ret.push(file_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,7 +474,7 @@ impl<'gctx> PathSource<'gctx> {
|
|||||||
repo: &gix::Repository,
|
repo: &gix::Repository,
|
||||||
filter: &dyn Fn(&Path, bool) -> bool,
|
filter: &dyn Fn(&Path, bool) -> bool,
|
||||||
) -> CargoResult<Vec<PathBuf>> {
|
) -> CargoResult<Vec<PathBuf>> {
|
||||||
warn!("list_files_gix {}", pkg.package_id());
|
debug!("list_files_gix {}", pkg.package_id());
|
||||||
let options = repo
|
let options = repo
|
||||||
.dirwalk_options()?
|
.dirwalk_options()?
|
||||||
.emit_untracked(gix::dir::walk::EmissionMode::Matching)
|
.emit_untracked(gix::dir::walk::EmissionMode::Matching)
|
||||||
@ -559,7 +555,7 @@ impl<'gctx> PathSource<'gctx> {
|
|||||||
// our own `Cargo.toml`, we keep going.
|
// our own `Cargo.toml`, we keep going.
|
||||||
let path = file_path.parent().unwrap();
|
let path = file_path.parent().unwrap();
|
||||||
if path != pkg_path {
|
if path != pkg_path {
|
||||||
warn!("subpackage found: {}", path.display());
|
debug!("subpackage found: {}", path.display());
|
||||||
files.retain(|p| !p.starts_with(path));
|
files.retain(|p| !p.starts_with(path));
|
||||||
subpackages_found.push(path.to_path_buf());
|
subpackages_found.push(path.to_path_buf());
|
||||||
continue;
|
continue;
|
||||||
@ -595,7 +591,7 @@ impl<'gctx> PathSource<'gctx> {
|
|||||||
}
|
}
|
||||||
} else if (filter)(&file_path, is_dir) {
|
} else if (filter)(&file_path, is_dir) {
|
||||||
assert!(!is_dir);
|
assert!(!is_dir);
|
||||||
warn!(" found {}", file_path.display());
|
trace!(" found {}", file_path.display());
|
||||||
files.push(file_path);
|
files.push(file_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user