dolt revert to more closely match git#11073
Merged
Merged
Conversation
Adds two enginetests covering dolt_revert's working-set behavior to ensure it is the same as git. Tests currently fail. Related: dolthub/doltlite#961
Contributor
|
@macneale4 DOLT
|
Contributor
|
@macneale4 DOLT
|
This was referenced May 19, 2026
Contributor
|
@macneale4 DOLT
|
Merged
5 tasks
timsehn
pushed a commit
to dolthub/doltlite
that referenced
this pull request
May 20, 2026
…-up)
Dolt 2.0.5 tightened dolt_revert's dirty-set check to match git's
behavior:
1. Any staged change refuses the revert, even when the staged
table is unrelated to the revert target. Mirrors git's
"index must be clean" requirement — otherwise the revert
commit would mix staged work with the inverse-change commit.
2. Unstaged changes refuse the revert only if they overlap with
a table the revert would touch. Disjoint unstaged changes
are allowed and get folded into the revert commit.
Previous doltlite behavior was "refuse only if dirty change touches
a table the revert would also touch", which allowed staged-disjoint
to proceed. That diverged from Dolt 2.0.5 on
revert_head_staged_unrelated_table_committed (caught by
vc_oracle_revert_test.sh once Dolt was upgraded to 2.0.5).
Replace doltliteRevertHasDirtyTouchedTables /
doltliteCollectRevertTouchedTables / their internal name-list helpers
with a single doltliteRevertCheckDirty that does both checks inline:
* If session-staged catalog hash differs from session-head hash,
flag dirty regardless of which tables differ.
* Else compare working catalog to head; for each differing table,
check whether the revert target catalog and parent catalog
differ on that same table — if so, flag dirty.
Error message also updated to match Dolt's:
"Your local changes would be overwritten by revert.\nhint: ..."
Verified against /tmp/dolt-2.0.5 binary downloaded from the v2.0.5
release:
* vc_oracle_revert_test.sh: 6/6 pass (was 5/6 with the staged-disjoint
case failing before this change)
* vc_oracle_revert_cherrypick_test.sh: 45/45 pass
* doltlite_merge.sh: 91/91 pass
* doltlite_conflicts.sh: 40/40 pass
* doltlite_advanced.sh: 140/140 pass
References: Dolt PR dolthub/dolt#11073 ("dolt revert to more closely
match git") and follow-up commit 014f1d8 ("align revert dirty-set
rules with git") in dolthub/dolt v2.0.5.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Related: dolthub/doltlite#961