Skip to content

refactor(core): consolidate git directory resolution and pause state management - #80

Merged
JacksonFergusonDev merged 1 commit into
mainfrom
refactor/consolidate-git-dir-and-pause-state
Aug 22, 2026
Merged

refactor(core): consolidate git directory resolution and pause state management#80
JacksonFergusonDev merged 1 commit into
mainfrom
refactor/consolidate-git-dir-and-pause-state

Conversation

@JacksonFergusonDev

Copy link
Copy Markdown
Owner

Summary

This PR addresses DRY (Don't Repeat Yourself) violations in Git directory resolution and repository pause state management:

  1. Centralize Git Directory Resolution:

    • Replaced duplicate _get_git_dir(repo_path: Path) -> Path helper definitions across ops.py, daemon.py, and cli.py with a top-level get_git_dir(repo_path: Path) -> Path in git_wrapper.py.
    • Updated call sites in daemon.py (temporary_index, is_repo_busy), cli.py (_check_git_hooks), and ops.py (get_drift_state, set_drift_state).
  2. Encapsulate Repository Pause State Handling:

    • Introduced ops.is_repo_paused(repo_path: Path) -> bool and ops.set_repo_paused(repo_path: Path, paused: bool) -> None.
    • Replaced ad-hoc .git/pulsar_paused sentinel checking and file operations across daemon._should_skip, cli._check_repo_health, cli.show_status, cli.list_repos, cli.set_pause_state, and cli.run_doctor.
  3. Automated Tests:

    • Added unit tests in test_git_wrapper.py verifying get_git_dir against standard repositories, worktrees, and non-git fallback directories.
    • Added unit tests in test_ops.py validating is_repo_paused and set_repo_paused behavior.

Verification

  • All 158 pytest tests passing locally.
  • Pre-commit hooks (ruff check, ruff format, mypy) passing cleanly.

…management

- Add get_git_dir helper in git_wrapper.py and remove duplicate _get_git_dir definitions from ops.py, daemon.py, and cli.py
- Add ops.is_repo_paused and ops.set_repo_paused to centralize repository pause sentinel handling
- Update daemon and cli modules to use the centralized pause helpers and get_git_dir
- Add unit tests for get_git_dir resolution and pause state operations
@JacksonFergusonDev
JacksonFergusonDev merged commit 02cae44 into main Aug 22, 2026
7 checks passed
@JacksonFergusonDev
JacksonFergusonDev deleted the refactor/consolidate-git-dir-and-pause-state branch August 22, 2026 18:48
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