From 252ad98bc9cd03def882372afc7e81bf8af88aca Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Wed, 18 Dec 2024 23:11:58 -0500 Subject: [PATCH 1/2] refactor(cargo-package): rename unclear argument `p` --- src/cargo/ops/cargo_package.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 30445b8643f..570b96a782d 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -780,7 +780,7 @@ fn check_repo_state( return Ok(None); fn git( - p: &Package, + pkg: &Package, src_files: &[PathBuf], repo: &git2::Repository, opts: &PackageOpts<'_>, @@ -803,7 +803,7 @@ fn check_repo_state( .iter() .filter(|src_file| dirty_files.iter().any(|path| src_file.starts_with(path))) .map(|path| { - path.strip_prefix(p.root()) + path.strip_prefix(pkg.root()) .unwrap_or(path) .display() .to_string() From 6d6b6089fc09006d95d9646916ebc6fdf91ea315 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Wed, 18 Dec 2024 23:11:05 -0500 Subject: [PATCH 2/2] fix(cargo-package): add more traces --- src/cargo/ops/cargo_package.rs | 4 ++++ src/cargo/sources/path.rs | 1 + 2 files changed, 5 insertions(+) diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 570b96a782d..7ccc6fc1ea1 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -94,6 +94,7 @@ struct GitVcsInfo { } // Builds a tarball and places it in the output directory. +#[tracing::instrument(skip_all)] fn create_package( ws: &Workspace<'_>, pkg: &Package, @@ -372,6 +373,7 @@ fn local_deps(packages: impl Iterator) -> LocalDependenc } /// Performs pre-archiving checks and builds a list of files to archive. +#[tracing::instrument(skip_all)] fn prepare_archive( ws: &Workspace<'_>, pkg: &Package, @@ -400,6 +402,7 @@ fn prepare_archive( } /// Builds list of files to archive. +#[tracing::instrument(skip_all)] fn build_ar_list( ws: &Workspace<'_>, pkg: &Package, @@ -730,6 +733,7 @@ fn check_metadata(pkg: &Package, gctx: &GlobalContext) -> CargoResult<()> { /// has not been passed, then `bail!` with an informative message. Otherwise /// return the sha1 hash of the current *HEAD* commit, or `None` if no repo is /// found. +#[tracing::instrument(skip_all)] fn check_repo_state( p: &Package, src_files: &[PathBuf], diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs index 1d4a533a3c4..7765906977f 100644 --- a/src/cargo/sources/path.rs +++ b/src/cargo/sources/path.rs @@ -93,6 +93,7 @@ impl<'gctx> PathSource<'gctx> { /// are relevant for building this package, but it also contains logic to /// use other methods like `.gitignore`, `package.include`, or /// `package.exclude` to filter the list of files. + #[tracing::instrument(skip_all)] pub fn list_files(&self, pkg: &Package) -> CargoResult> { list_files(pkg, self.gctx) }