Skip to content

Conversation

@JacksonFergusonDev
Copy link
Owner

@JacksonFergusonDev JacksonFergusonDev commented Jan 31, 2026

Summary

This PR refactors the core backup logic to use a pure git reference namespace (refs/heads/wip/pulsar/...) instead of relying on a local "zombie" branch. This eliminates the need for the daemon to create or switch branches in the user's working directory, ensuring git status remains clean and preventing "detached HEAD" states during backup operations.

Changes

  • Core (constants.py): Replaced BACKUP_BRANCH with BACKUP_NAMESPACE to reflect that we are writing to a ref hierarchy, not a check-out-able branch.
  • Ops (ops.py): Updated get_backup_ref and synchronization logic (finalize_work, sync_session) to construct references dynamically based on the current machine ID and active branch.
  • CLI (cli.py): - Removed setup_repo logic that forced the creation/checkout of wip/pulsar.
    • Updated status, diff, and list commands to resolve backup refs dynamically via a helper, fixing DRY violations.
  • Daemon (daemon.py): Updated the shadow commit logic to write directly to the namespaced ref without interacting with the working tree's HEAD.
  • Tests: Removed legacy assertions checking for branch switching and updated test cases to use the new BACKUP_NAMESPACE constant.

Fixes

  • Fixed a bug where git-pulsar diff or status would crash or show incorrect info if the local wip/pulsar branch was deleted.
  • Fixed "zombie branch" behavior where initializing a repo would annoyingly switch the user away from main.

Verification

  • uv run pytest passes (Tests updated to match new ref logic).
  • Manual git-pulsar status correctly identifies backup state.
  • finalize and sync commands successfully resolve remote references using the new namespace wildcard.

@JacksonFergusonDev JacksonFergusonDev merged commit 1f328ad into main Jan 31, 2026
4 checks passed
@JacksonFergusonDev JacksonFergusonDev deleted the feature/ref-namespace branch January 31, 2026 21:56
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.

2 participants