Skip to content

fix(7) [orphan/adopt]: properly display checked out branches#33

Merged
mark-pro merged 3 commits intomainfrom
fix/7-render-orphaned-under-tree
Mar 31, 2026
Merged

fix(7) [orphan/adopt]: properly display checked out branches#33
mark-pro merged 3 commits intomainfrom
fix/7-render-orphaned-under-tree

Conversation

@mark-pro
Copy link
Copy Markdown
Member

@mark-pro mark-pro commented Mar 31, 2026

fixes #7

This pull request refactors how branch trees are rendered and displayed in the CLI, especially after operations like adopt, orphan, and reparent. The main change is the introduction of a new render_focused_context_tree function, which allows for more flexible and accurate rendering of the current branch context, including handling of orphaned branches and improved visibility logic. Additionally, the tree rendering logic and data structures have been updated to support these new features, and several tests have been added or updated to ensure correctness.

Rendering and visibility improvements:

  • Added a new render_focused_context_tree function to handle rendering the focused branch context, including support for suffixes (such as marking a branch as "(orphaned)"). This function is now used in the adopt, orphan, reparent, and sync CLI commands, replacing the previous two-step approach of building a view and then rendering it. [1] [2] [3] [4] [5] [6]

  • Enhanced the TreeView struct to include current_branch_name, is_current_visible, and current_branch_suffix fields, enabling more nuanced rendering of the current branch and its visibility.

  • Updated the tree rendering logic in render_stack_tree to display the current branch at the bottom of the tree if it is not visible in the main tree structure, including support for suffixes (e.g., "(orphaned)").

Tree building and filtering logic:

  • Refactored the tree building and filtering functions to correctly propagate and update the new visibility and suffix fields, and removed redundant code for marking the current branch. [1] [2] [3] [4] [5] [6] [7]

Rendering style changes:

  • Updated the branch label formatting to include a marker for non-current branches, making the tree output more visually distinct.

Testing improvements:

  • Added and updated tests for the new rendering logic, including cases for hidden tracked and orphaned branches, and updated expected outputs to match the new rendering style. [1] [2] [3] [4] [5] [6]

@mark-pro mark-pro merged commit f22c377 into main Mar 31, 2026
1 check passed
@mark-pro mark-pro deleted the fix/7-render-orphaned-under-tree branch March 31, 2026 23:26
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.

bug: orphan tree shows parent as checked out after orphan

1 participant