noirbizarre / noirbizarre/git-wipe

Support Jujutsu (jj) colocated repositories

Open
#81 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5
Forks
0
Avg merge
2d 9m
Merged PRs (30d)
1

Description

Assessment of running git-wipe inside a Jujutsu repository, verified empirically against jj 0.44.0 and git 2.55.0.

Colocated repos (jj's default since ~0.32) already mostly work: refs/heads are real git refs, git branch --merged, all six content strategies, fetch --prune, push --delete and branch -D all behave, and jj auto-imports a git-side branch deletion (Done importing changes from the underlying Git repo.), which is jj op undo-able. Four things are wrong or inert.

1. Detached HEAD leaks a phantom branch into local_branches()

src/git.rs:511-518 runs git branch --format=%(refname:short) and keeps every non-empty line. git branch always lists the detached-HEAD pseudo-entry, even with --format, so the result contains a bogus branch name.

  • Plain git, detached HEAD → (HEAD detached at 45c62f9)
  • jj colocated (HEAD is permanently detached at the working-copy parent) → (no branch), and it is locale-dependent: (aucune branche) under fr_FR

Consequences: the phantom name enters the merge-detection pool, so git cherry / patch-id probes are run against it and fail; it shows up in git wipe status; and git branch -D "(no branch)" would exit 1.

Note this is not jj-specific — it reproduces in plain git under any detached HEAD. merged_branches() is unaffected because parse_branch_list (src/git.rs:1106) already drops *-prefixed lines; only the --format path is missing that filter.

Fix direction: use git for-each-ref --format=%(refname:short) refs/heads (the same plumbing branches_with_gone_upstream and branch_committer_dates already use), which never emits a pseudo-entry and is locale-proof.

2. --delete-gone is permanently inert under jj

jj stores remote-bookmark tracking in .jj, never in git config — a colocated repo has no branch.<name>.remote / branch.<name>.merge entries (git config --get-regexp '^branch\.' exits 1). So branches_with_gone_upstream (src/git.rs:530) and branch_upstream (src/git.rs:455) always return nothing.

Not a bug so much as a limitation to document; jj users get no gone-branch detection. refs/remotes/* are written by jj, so merged-remote detection and remote deletion still work.

3. Current-branch protection is a no-op

current_branch (src/git.rs:406) returns the literal HEAD in a colocated jj repo. Nothing real is excluded from the deletion pool, so the bookmark at the working-copy parent is eligible. Low severity — such a branch is only deleted if proven merged, and jj keeps the commits reachable and the operation undoable — but the intended safety net is silently absent.

4. jj workspaces are not git worktrees

jj workspace add ../ws1 creates no git worktree; git worktree list --porcelain still reports only the main one. Worktree discovery, --min-age, lock handling and the worktrunk integration therefore have nothing to act on in a jj repo. Harmless, but the feature simply does not exist for jj users.

Plus: non-colocated repos

jj git init --no-colocate leaves no .git at all; git rev-parse --is-inside-work-tree fails and git-wipe exits via its is_inside_work_tree guard. Clean refusal, no data risk. Worth an explicit "colocated only" line in the README rather than any code change.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/git.rs at current_branch, local_branches, branches_with_gone_upstream, and branch_upstream, then review the existing for-each-ref callers. Verify detached-head behavior and jj colocated repositories against the documented cases, and update README for the colocated-only and unsupported jj features. Done means phantom branches are excluded without locale dependence and the limitations are explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
cli, devtools, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.