dolt icon indicating copy to clipboard operation
dolt copied to clipboard

`dolt cherry-pick --abort` reverts ignored tables.

Open nicktobey opened this issue 7 months ago • 0 comments

Ignored tables are tables that exist at in the working set that are never staged. Commands should typically ignore them.

dolt cherry-pick --abort should reset the branch to the state it was in prior to the cherry-pick.

Given these two facts, we should expect that aborting a cherry-pick should have no effect on ignored tables. But this does not seem to be the case.

dolt sql <<SQL
INSERT INTO dolt_ignore VALUES ('generated_*', 1);
CREATE TABLE generated_foo (pk int PRIMARY KEY);
CREATE TABLE test(pk INT PRIMARY KEY, col INT);
INSERT INTO test VALUES (1, 1);
SQL
dolt add .
dolt commit -am "Add test table"
dolt checkout -b other
dolt sql -q "UPDATE test SET col = 2"
dolt commit -am "Update test table"
dolt checkout main
dolt sql -q "DELETE FROM test"
dolt commit -am "Delete from test table"
dolt cherry-pick other
dolt status --ignored

Final output:

On branch main
nothing to commit, working tree clean

This is especially alarming since it seems to delete the table entirely. (It still exists the chunkstore, but since it was never in a commit, most users won't know how to recover it.)

nicktobey avatar Jan 24 '24 01:01 nicktobey