Skip to content

Commit 1296566

Browse files
authored
fix(cargo-package): add more traces (#14960)
### What does this PR try to resolve? This helps debug <#14955>. ### How should we test and review this PR? While `check_repo_state` is the culprit, let's add some traces for future. ### Additional information
2 parents 58b2d60 + 6d6b608 commit 1296566

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/cargo/ops/cargo_package.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct GitVcsInfo {
9494
}
9595

9696
// Builds a tarball and places it in the output directory.
97+
#[tracing::instrument(skip_all)]
9798
fn create_package(
9899
ws: &Workspace<'_>,
99100
pkg: &Package,
@@ -372,6 +373,7 @@ fn local_deps<T>(packages: impl Iterator<Item = (Package, T)>) -> LocalDependenc
372373
}
373374

374375
/// Performs pre-archiving checks and builds a list of files to archive.
376+
#[tracing::instrument(skip_all)]
375377
fn prepare_archive(
376378
ws: &Workspace<'_>,
377379
pkg: &Package,
@@ -400,6 +402,7 @@ fn prepare_archive(
400402
}
401403

402404
/// Builds list of files to archive.
405+
#[tracing::instrument(skip_all)]
403406
fn build_ar_list(
404407
ws: &Workspace<'_>,
405408
pkg: &Package,
@@ -730,6 +733,7 @@ fn check_metadata(pkg: &Package, gctx: &GlobalContext) -> CargoResult<()> {
730733
/// has not been passed, then `bail!` with an informative message. Otherwise
731734
/// return the sha1 hash of the current *HEAD* commit, or `None` if no repo is
732735
/// found.
736+
#[tracing::instrument(skip_all)]
733737
fn check_repo_state(
734738
p: &Package,
735739
src_files: &[PathBuf],
@@ -780,7 +784,7 @@ fn check_repo_state(
780784
return Ok(None);
781785

782786
fn git(
783-
p: &Package,
787+
pkg: &Package,
784788
src_files: &[PathBuf],
785789
repo: &git2::Repository,
786790
opts: &PackageOpts<'_>,
@@ -803,7 +807,7 @@ fn check_repo_state(
803807
.iter()
804808
.filter(|src_file| dirty_files.iter().any(|path| src_file.starts_with(path)))
805809
.map(|path| {
806-
path.strip_prefix(p.root())
810+
path.strip_prefix(pkg.root())
807811
.unwrap_or(path)
808812
.display()
809813
.to_string()

src/cargo/sources/path.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ impl<'gctx> PathSource<'gctx> {
9393
/// are relevant for building this package, but it also contains logic to
9494
/// use other methods like `.gitignore`, `package.include`, or
9595
/// `package.exclude` to filter the list of files.
96+
#[tracing::instrument(skip_all)]
9697
pub fn list_files(&self, pkg: &Package) -> CargoResult<Vec<PathBuf>> {
9798
list_files(pkg, self.gctx)
9899
}

0 commit comments

Comments
 (0)