Skip to content

feat: add debug logging to worktree creation and removal operations#101

Closed
matt2e wants to merge 2 commits intomainfrom
branch-research
Closed

feat: add debug logging to worktree creation and removal operations#101
matt2e wants to merge 2 commits intomainfrom
branch-research

Conversation

@matt2e
Copy link
Contributor

@matt2e matt2e commented Feb 13, 2026

Add comprehensive debug and info logging throughout worktree lifecycle operations to aid in diagnosing issues:

  • git/worktree.rs: Add logging to create_worktree, create_worktree_for_existing_branch, create_worktree_from_pr, and remove_worktree — including input parameters, resolved paths, git command outputs, partial-creation detection, and existing worktree context.
  • git/cli.rs: Log the full git command being executed and capture stderr on failure for better error diagnostics.
  • lib.rs (setup_worktree): Add logging around worktree and workdir record creation with error context.

These logs use log::info, log::debug, log::warn, and log::error levels to provide visibility into worktree operations without being noisy at default log levels.

Add comprehensive logging throughout the worktree lifecycle to help
diagnose issues where worktree creation fails silently (directory
appears briefly then disappears, UI shows infinite spinner).

Changes:
- git/cli.rs: Log every git command invocation at debug level, and log
  stderr/stdout on command failure with exit code for diagnostics
- git/worktree.rs: Add info/debug/error/warn logs to create_worktree,
  create_worktree_for_existing_branch, create_worktree_from_pr, and
  remove_worktree covering:
  - Function entry with parameters
  - Resolved worktree paths
  - Parent directory creation failures
  - Pre-existing worktree path conflicts
  - Existing worktree list (for diagnosing 'branch already checked out')
  - Git command invocation and result (success output, failure details)
  - Post-failure directory state (partial creation vs git cleanup)
  - Removal fallback paths and branch deletion
- lib.rs: Add logging to setup_worktree command for the full Tauri
  command lifecycle (entry, repo/branch context, worktree creation
  result, workdir record creation, completion)
@matt2e matt2e marked this pull request as draft February 13, 2026 18:10
Lower the tauri-plugin-log level from Info to Debug in development
builds so that the new debug!() instrumentation in worktree creation
and removal is visible in the terminal and WebView console.
@matt2e matt2e closed this Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments