Files
dolt/integration-tests/bats/commit.bats
Dhruv Sringari 7e0a66b68f Add -A (--ALL) to dolt commit and CALL DOLT_COMMIT (#4347)
* Add -A (--ALL) to dolt commit

-A adds all tables (including) new tables to the staged set before committing

* [ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/update.sh

* bump prepareds, PR comment

Co-authored-by: druvv <druvv@users.noreply.github.com>
2022-09-16 11:38:25 -07:00

43 lines
1.1 KiB
Bash

#!/usr/bin/env bats
load $BATS_TEST_DIRNAME/helper/common.bash
setup() {
setup_common
}
teardown() {
assert_feature_version
teardown_common
}
@test "commit: -ALL (-A) adds all tables including new ones to the staged set." {
dolt sql -q "CREATE table t (pk int primary key);"
dolt sql -q "INSERT INTO t VALUES (1);"
dolt add t
dolt commit -m "add table t"
dolt reset --hard
run dolt sql -q "SELECT * from t;"
[ $status -eq 0 ]
[[ "$output" =~ "| 1" ]] || false
dolt sql -q "DELETE from t where pk = 1;"
dolt commit -ALL -m "update table t"
dolt reset --hard
run dolt sql -q "SELECT * from t;"
[ $status -eq 0 ]
[[ ! "$output" =~ "| 1" ]] || false
dolt sql -q "DROP TABLE t;"
dolt commit -Am "drop table t;"
dolt reset --hard
run dolt ls
[ $status -eq 0 ]
[[ "$output" =~ "No tables in working set" ]] || false
dolt sql -q "CREATE table t2 (pk int primary key);"
dolt commit -Am "add table t2"
dolt reset --hard
run dolt ls
[ $status -eq 0 ]
[[ "$output" =~ "t2" ]] || false
}