Repository navigation
Codeaucafe/10488 - #10616
Merged
Merged
Codeaucafe/10488#10616
Conversation
Add support for --overwrite-ignore and --no-overwrite-ignore flags to dolt checkout, matching Git's behavior. By default, ignored tables are silently overwritten during branch switch (preserving existing behavior). The new --no-overwrite-ignore flag aborts the checkout if any ignored tables would be overwritten. Changes: - Add flag definitions in flags.go and arg_parser_helpers.go - Thread overwriteIgnore parameter through SQL procedure call chain in dolt_checkout.go and dolt_checkout_helpers.go - Implement FindOverwrittenIgnoredTables() in checkout.go to identify ignored tables that differ between current working root and target branch - Add ErrCheckoutWouldOverwriteIgnoredTables error type - Add CLI-level mutual exclusivity validation and error handling - Add 9 BATS integration tests Note, the implementation handles two checkout paths: 1. With uncommitted changes: check runs via RootsForBranch() during transferWorkingChanges() 2. Without uncommitted changes: check runs before SwitchWorkingSet() in MoveWorkingSetToBranch() Refs: #10488
Fix FindOverwrittenIgnoredTables to correctly handle the case where an ignored table exists in the working set but not on the target branch. Before, the function would incorrectly flag this as an overwrite scenario when using --no-overwrite-ignore. Added test for this scenario. Also, used tbl.String() in FindOverwrittenIgnoredTables instead of tbl.Name for consistent table name formatting in error messaging. Refs: #10488
Extract repeated ignored table check logic into a helper func. Also, add more edge case tests. Also improve error message wording and add code comments explaining the semantics of the --no-overwrite-ignore flag. Refs: #10488
Only resolve the target branch head root in the non-move checkout path when --no-overwrite-ignore is specified. In the default case (overwrite allowed), the branch head is not needed for the ignored table check. Also refactor error message. Refs: #10488
Contributor
Move CheckOverwrittenIgnoredTables out of RootsForBranch and transferWorkingChanges and into MoveWorkingSetToBranch. This keeps ignored-table logic at correct abstraction level rather than threading it through low-level root-move helpers. Also, add SQL engine tests to DoltCheckoutScripts to validate the overwrite-ignore flags through the SQL procedure path. Refs: #10488
Contributor
Contributor
Replace the ErrCheckoutWouldOverwriteIgnoredTables plain struct with a errors.Kind so the test assertion can use ExpectedErr instead of ExpectedErrStr. This eliminates the DoltgreSQL incompatibility where the error message contained schema-qualified table names (e.g. public.ignored_tbl) that did not match the Dolt-only string. Kind.Is() ignores the formatted message entirely, making the check engine-agnostic. Refs: #10488
…e/10488-add-overwrite-and-no-overwrite-ignore-flags
…e/10488-add-overwrite-and-no-overwrite-ignore-flags
Contributor
|
@elianddb DOLT
|
Contributor
Contributor
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.
Companion #10549