From ffb067a63b012328e7429f75ac4fe213065d6ee6 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 29 Aug 2024 14:46:58 +0200 Subject: [PATCH] Improve the clarity of performance logs --- crates/gitbutler-branch-actions/src/actions.rs | 1 + crates/gitbutler-branch-actions/src/branch.rs | 2 ++ .../src/branch_manager/branch_removal.rs | 4 ++++ crates/gitbutler-branch-actions/src/integration.rs | 1 + 4 files changed, 8 insertions(+) diff --git a/crates/gitbutler-branch-actions/src/actions.rs b/crates/gitbutler-branch-actions/src/actions.rs index 801a7a4216..943286371e 100644 --- a/crates/gitbutler-branch-actions/src/actions.rs +++ b/crates/gitbutler-branch-actions/src/actions.rs @@ -570,6 +570,7 @@ impl VirtualBranchActions { branch::move_commit(&ctx, target_branch_id, commit_oid).map_err(Into::into) } + #[instrument(level = tracing::Level::DEBUG, skip(self, project), err(Debug))] pub fn create_virtual_branch_from_branch( &self, project: &Project, diff --git a/crates/gitbutler-branch-actions/src/branch.rs b/crates/gitbutler-branch-actions/src/branch.rs index 67bd1b6512..b7d12c4e09 100644 --- a/crates/gitbutler-branch-actions/src/branch.rs +++ b/crates/gitbutler-branch-actions/src/branch.rs @@ -24,7 +24,9 @@ use std::{ fmt::Debug, vec, }; +use tracing::instrument; +#[instrument(level = tracing::Level::DEBUG, skip(ctx, _permission))] pub(crate) fn get_uncommited_files_raw( ctx: &CommandContext, _permission: &WorktreeReadPermission, diff --git a/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs b/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs index bba1cb0ef7..36d80a77a0 100644 --- a/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs +++ b/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs @@ -8,6 +8,7 @@ use gitbutler_oplog::SnapshotExt; use gitbutler_project::access::WorktreeWritePermission; use gitbutler_reference::{normalize_branch_name, ReferenceName, Refname}; use gitbutler_repo::{RepoActionsExt, RepositoryExt}; +use tracing::instrument; use super::BranchManager; use crate::{ @@ -19,6 +20,7 @@ use crate::{ impl BranchManager<'_> { // to unapply a branch, we need to write the current tree out, then remove those file changes from the wd + #[instrument(level = tracing::Level::DEBUG, skip(self, perm), err(Debug))] pub fn convert_to_real_branch( &self, branch_id: BranchId, @@ -52,6 +54,7 @@ impl BranchManager<'_> { real_branch.reference_name() } + #[instrument(level = tracing::Level::DEBUG, skip(self, perm), err(Debug))] pub(crate) fn delete_branch( &self, branch_id: BranchId, @@ -128,6 +131,7 @@ impl BranchManager<'_> { } impl BranchManager<'_> { + #[instrument(level = tracing::Level::DEBUG, skip(self, vbranch), err(Debug))] fn build_real_branch(&self, vbranch: &mut Branch) -> Result> { let repo = self.ctx.repository(); let target_commit = repo.find_commit(vbranch.head)?; diff --git a/crates/gitbutler-branch-actions/src/integration.rs b/crates/gitbutler-branch-actions/src/integration.rs index d1d8f8f397..a507180826 100644 --- a/crates/gitbutler-branch-actions/src/integration.rs +++ b/crates/gitbutler-branch-actions/src/integration.rs @@ -122,6 +122,7 @@ fn write_integration_file(head: &git2::Reference, path: PathBuf) -> Result<()> { std::fs::write(path, format!(":{}", sha))?; Ok(()) } +#[instrument(level = tracing::Level::DEBUG, skip(vb_state, ctx), err(Debug))] pub fn update_gitbutler_integration( vb_state: &VirtualBranchesHandle, ctx: &CommandContext,