Conversation
stage, unstage, commit, stash, unstash, and checkout now detect unmerged files (UU, AA, DD, AU, UA, DU, UD) and refuse cleanly with a message pointing the user at git merge --abort or manual resolution. Previously these commands could either pass the file to git (which would fail with a cryptic error) or, worse, silently succeed on a partial operation leaving the repo in an unclear state. add, remove, delete, status, and diff are unchanged: they either only touch cl.json or are read-only, and users may legitimately want to reorganise changelists mid-merge.
Covers the new merge-conflict guards in stage, unstage, commit, stash, unstash, and checkout. Also verifies that add and remove still work mid-merge, and that all commands recover after the conflict is resolved. Conflict setup is done inline (two branches modifying the same file, then git merge) so the exported shell walkthrough shows the full reproduction steps.
Before: `git cl status` during a merge hid conflicted files behind the "uncommon Git status codes" message, requiring --all to see them. After: conflict codes (UU, AA, DD, AU, UA, DU, UD) are part of the default status view, coloured red to match git's own convention, and an advisory line reminds the user to resolve before proceeding. Complements the refusal guards from the preceding commit: the user can now see what needs resolving as easily as they are told they can't proceed without resolving it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
git-clcommands behaved poorly during unresolved merges: conflicted files were hidden fromstatus, and state-mutating commands either failed with crypticgiterrors or proceeded with partial operations.Changes
stage,unstage,commit,stash,unstash, andcheckout. They detect merge-conflict codes (UU, AA, DD, AU, UA, DU, UD) and refuse cleanly, naming the conflicted files and pointing atgit merge --abortor manual resolution.statusoutput: conflicts are now part of the default view (previously hidden behind--all), coloured red to match git's own convention, with an advisory line when conflicts are present.add,remove,delete,diffunchanged: users may legitimately reorganise changelists mid-merge.Implementation
Two new helpers (
clutil_detect_merge_conflicts,clutil_refuse_on_merge_conflict) and a two-line guard in each affected command. Around 45 lines added, zero removed.Tests
New
test_merge_conflict.pycovers all six refusals, verifiesadd/removestill work mid-merge, and confirms normal operation resumes after resolution. Uses inline conflict setup so the--exportwalkthrough shows readers how to reproduce the scenario.