Skip to main content

Module rule_linked_worktree_messages

Module rule_linked_worktree_messages 

Source
Expand description

The rejection texts of the linked-worktree-only policy. What: The rejection texts of the linked-worktree policy: outside any worktree, in the main worktree, and in a worktree that holds uncommitted state. Why: Each text names the command, says what it could destroy, guesses what the person was trying to do, and names a sanctioned way to do that without losing work; the deliberate way to discard anyway comes last. Every alternative named here is run through the built executable by binary_discard_tests.rs, and the README lists each form with the same alternatives.

In TS you’d write (pseudocode):

// mainWorktreeMessage('restore-staged') === 'cli-git: git restore --staged is rejected in the main git worktree: ...'

Functions§

dirty_worktree_message
What: The rejection text for a command run in a worktree that holds uncommitted state. Why: The state is what the command could destroy; committing it with explicit paths or moving to a clean linked worktree are the ways forward that lose nothing.
main_worktree_message
What: The rejection text for a command run in the main worktree. Why: The text says what the command could destroy and what to do instead.
outside_worktree_message
What: The rejection text for a command run where there is no worktree. Why: The text says what the command could destroy and how to run it safely.