Skip to content

Commit 96f7f14

Browse files
max-sixtyclaude
andcommitted
docs(remove): describe all warn_if_branch_retained arms after CAS
The doc rewrite that came with the CAS commit only mentioned the NotDeleted-race case. Spell out RetainedRaced, NotDeleted (with the planner-predicted-retention suppression), the silent success arms, and the log::warn! Err arm so the file reads consistently after the rebase onto the PR-2900 simplification. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent eafced3 commit 96f7f14

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

src/output/handlers.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,24 +287,26 @@ fn delete_branch_in_synchronous_fallback(
287287
warn_if_branch_retained(branch, &result, planner_expected_retention);
288288
}
289289

290-
/// Surface the residual branch when `delete_branch_if_safe` returned
291-
/// `Ok(NotDeleted)` for a case the planner expected to delete.
290+
/// Surface the residual branch when `delete_branch_if_safe` returned an
291+
/// unexpected outcome the user wouldn't otherwise see.
292292
///
293293
/// The worktree has already been removed by the time this runs, so silently
294294
/// dropping the branch-deletion outcome (the prior behavior) left the user
295295
/// with no signal that the branch survived. Both the fast path and the
296296
/// synchronous fallback route through here so the message is consistent.
297297
///
298-
/// Only the surprise case is surfaced: planner predicted deletion (the
299-
/// pre-hook integration check said integrated) but the post-hook check
300-
/// said otherwise — typically a `pre-remove` hook commit. When the planner
301-
/// already predicted retention (unmerged from the start, or
302-
/// `--no-delete-branch`), `print_hints` has explained the case and a
303-
/// second message would duplicate. `Ok(ForceDeleted)`, `Ok(Integrated(_))`,
304-
/// and `Err` paths are silent — Err is logged at warn level for developer
305-
/// diagnostics rather than as a user-actionable message (the failure mode
306-
/// would be a `git branch -D` exec error or a refs DB I/O failure, neither
307-
/// of which the user can act on differently than re-running the command).
298+
/// - `Ok(RetainedRaced)`: atomic CAS rejected the delete because the ref
299+
/// tip moved between integration check and delete (a hook, a concurrent
300+
/// push). Always surface — the unmerged commits would otherwise vanish
301+
/// silently from the user's view.
302+
/// - `Ok(NotDeleted)`: integration check declined the branch. Warn only
303+
/// when the planner predicted deletion (a `pre-remove` hook commit, or
304+
/// similar race) — otherwise `print_hints` has explained the case and a
305+
/// second message would duplicate.
306+
/// - `Ok(ForceDeleted)` / `Ok(Integrated(_))`: succeeded; no message.
307+
/// - `Err`: `log::warn!` for developer diagnostics; the failure modes
308+
/// here (`git update-ref` exec error, refs DB I/O failure) are not
309+
/// user-actionable beyond re-running the command.
308310
fn warn_if_branch_retained(
309311
branch: &str,
310312
result: &anyhow::Result<BranchDeletionResult>,

0 commit comments

Comments
 (0)