Change status_table type to use a byte rather than a bool

This commit is contained in:
Neil Macneale IV
2025-11-20 12:38:44 -08:00
parent d565cf2955
commit abd975f73a
16 changed files with 119 additions and 117 deletions

View File

@@ -361,6 +361,8 @@ func GetTinyIntColAsBool(col interface{}) (bool, error) {
switch v := col.(type) {
case bool:
return v, nil
case byte:
return v == 1, nil
case int:
return v == 1, nil
case string:

View File

@@ -107,7 +107,8 @@ type StatusItr struct {
type statusTableRow struct {
tableName string
status string
isStaged bool
isStaged byte // not a bool bc wire protocol confuses bools and tinyint(1), resulting in in consistent display
// of this table when you are using local vs remote sql connections.
}
func containsTableName(name string, names []doltdb.TableName) bool {
@@ -174,7 +175,7 @@ func newStatusItr(ctx *sql.Context, st *StatusTable) (*StatusItr, error) {
for _, tbl := range ms.TablesWithSchemaConflicts() {
rows = append(rows, statusTableRow{
tableName: tbl.String(),
isStaged: false,
isStaged: byte(0),
status: "schema conflict",
})
}
@@ -182,7 +183,7 @@ func newStatusItr(ctx *sql.Context, st *StatusTable) (*StatusItr, error) {
for _, tbl := range ms.MergedTables() {
rows = append(rows, statusTableRow{
tableName: tbl.String(),
isStaged: true,
isStaged: byte(1),
status: mergedStatus,
})
}
@@ -209,7 +210,7 @@ func newStatusItr(ctx *sql.Context, st *StatusTable) (*StatusItr, error) {
}
rows = append(rows, statusTableRow{
tableName: tblName,
isStaged: true,
isStaged: byte(1),
status: statusString(td),
})
}
@@ -223,7 +224,7 @@ func newStatusItr(ctx *sql.Context, st *StatusTable) (*StatusItr, error) {
}
rows = append(rows, statusTableRow{
tableName: tblName,
isStaged: false,
isStaged: byte(0),
status: statusString(td),
})
}
@@ -231,7 +232,7 @@ func newStatusItr(ctx *sql.Context, st *StatusTable) (*StatusItr, error) {
for _, sd := range stagedSchemas {
rows = append(rows, statusTableRow{
tableName: sd.CurName(),
isStaged: true,
isStaged: byte(1),
status: schemaStatusString(sd),
})
}
@@ -239,7 +240,7 @@ func newStatusItr(ctx *sql.Context, st *StatusTable) (*StatusItr, error) {
for _, sd := range unstagedSchemas {
rows = append(rows, statusTableRow{
tableName: sd.CurName(),
isStaged: false,
isStaged: byte(0),
status: schemaStatusString(sd),
})
}

View File

@@ -692,7 +692,7 @@ var DoltRevisionDbScripts = []queries.ScriptTest{
},
{
Query: "select * from dolt_status",
Expected: []sql.Row{{"t01", false, "modified"}},
Expected: []sql.Row{{"t01", byte(0), "modified"}},
},
{
Query: "call dolt_checkout('t01')",
@@ -726,11 +726,11 @@ var DoltScripts = []queries.ScriptTest{
Assertions: []queries.ScriptTestAssertion{
{
Query: "SELECT * FROM dolt_status;",
Expected: []sql.Row{{"t", false, "new table"}},
Expected: []sql.Row{{"t", byte(0), "new table"}},
},
{
Query: "SELECT * FROM `mydb/main`.dolt_status;",
Expected: []sql.Row{{"t", false, "new table"}},
Expected: []sql.Row{{"t", byte(0), "new table"}},
},
{
Query: "SELECT * FROM dolt_status AS OF 'tag1';",
@@ -743,7 +743,7 @@ var DoltScripts = []queries.ScriptTest{
{
// HEAD is a special revision spec
Query: "SELECT * FROM dolt_status AS OF 'head';",
Expected: []sql.Row{{"t", false, "new table"}},
Expected: []sql.Row{{"t", byte(0), "new table"}},
},
{
Query: "SELECT * FROM dolt_status AS OF 'HEAD~1';",
@@ -751,11 +751,11 @@ var DoltScripts = []queries.ScriptTest{
},
{
Query: "SELECT * FROM dolt_status AS OF 'branch1';",
Expected: []sql.Row{{"abc", true, "new table"}},
Expected: []sql.Row{{"abc", byte(1), "new table"}},
},
{
Query: "SELECT * FROM `mydb/branch1`.dolt_status;",
Expected: []sql.Row{{"abc", true, "new table"}},
Expected: []sql.Row{{"abc", byte(1), "new table"}},
},
},
},
@@ -3709,7 +3709,7 @@ var DoltCheckoutScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status",
Expected: []sql.Row{
{"t1", true, "modified"},
{"t1", byte(1), "modified"},
},
},
{
@@ -3740,7 +3740,7 @@ var DoltCheckoutScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status",
Expected: []sql.Row{
{"t2", true, "modified"},
{"t2", byte(1), "modified"},
},
},
{
@@ -3790,8 +3790,8 @@ var DoltCheckoutScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status",
Expected: []sql.Row{
{"t1", true, "modified"},
{"t2", true, "modified"},
{"t1", byte(1), "modified"},
{"t2", byte(1), "modified"},
},
},
{
@@ -4469,7 +4469,7 @@ var DoltResetTestScripts = []queries.ScriptTest{
{
// dolt_status should only show the unstaged table t being added
Query: "select * from dolt_status",
Expected: []sql.Row{{"t", false, "new table"}},
Expected: []sql.Row{{"t", byte(0), "new table"}},
},
},
},
@@ -4492,7 +4492,7 @@ var DoltResetTestScripts = []queries.ScriptTest{
{
// dolt_status should only show the unstaged table t being added
Query: "select * from dolt_status",
Expected: []sql.Row{{"t", false, "new table"}},
Expected: []sql.Row{{"t", byte(0), "new table"}},
},
},
},
@@ -7374,7 +7374,7 @@ var DoltCherryPickTests = []queries.ScriptTest{
},
{
Query: "select * from dolt_status",
Expected: []sql.Row{{"t", false, "modified"}, {"t", false, "conflict"}},
Expected: []sql.Row{{"t", byte(0), "modified"}, {"t", byte(0), "conflict"}},
},
{
Query: "select base_pk, base_v, our_pk, our_diff_type, their_pk, their_diff_type from dolt_conflicts_t;",
@@ -7388,7 +7388,7 @@ var DoltCherryPickTests = []queries.ScriptTest{
},
{
Query: "select * from dolt_status",
Expected: []sql.Row{{"t", false, "modified"}},
Expected: []sql.Row{{"t", byte(0), "modified"}},
},
{
Query: "select * from dolt_conflicts;",
@@ -7539,7 +7539,7 @@ var DoltCherryPickTests = []queries.ScriptTest{
{
// An ignored table should still be present (and unstaged) after aborting the merge.
Query: "select * from dolt_status;",
Expected: []sql.Row{{"generated_foo", false, "new table"}},
Expected: []sql.Row{{"generated_foo", byte(0), "new table"}},
},
{
// Changes made to the table during the merge should not be reverted.

View File

@@ -6163,7 +6163,7 @@ var DoltDatabaseCollationScriptTests = []queries.ScriptTest{
{
Query: "select * from dolt_status",
Expected: []sql.Row{
{"__DATABASE__mydb", false, "modified"},
{"__DATABASE__mydb", byte(0), "modified"},
},
},
{
@@ -6182,7 +6182,7 @@ var DoltDatabaseCollationScriptTests = []queries.ScriptTest{
{
Query: "select * from dolt_status",
Expected: []sql.Row{
{"__DATABASE__mydb", true, "modified"},
{"__DATABASE__mydb", byte(1), "modified"},
},
},
{
@@ -6245,7 +6245,7 @@ var DoltDatabaseCollationScriptTests = []queries.ScriptTest{
{
Query: "select * from dolt_status",
Expected: []sql.Row{
{"__DATABASE__mydb", false, "modified"},
{"__DATABASE__mydb", byte(0), "modified"},
},
},
{
@@ -6264,7 +6264,7 @@ var DoltDatabaseCollationScriptTests = []queries.ScriptTest{
{
Query: "select * from dolt_status",
Expected: []sql.Row{
{"__DATABASE__mydb", true, "modified"},
{"__DATABASE__mydb", byte(1), "modified"},
},
},
{
@@ -6327,7 +6327,7 @@ var DoltDatabaseCollationScriptTests = []queries.ScriptTest{
{
Query: "select * from dolt_status",
Expected: []sql.Row{
{"__DATABASE__mydb", false, "modified"},
{"__DATABASE__mydb", byte(0), "modified"},
},
},
{
@@ -6377,7 +6377,7 @@ var DoltDatabaseCollationScriptTests = []queries.ScriptTest{
{
Query: "select * from dolt_status;",
Expected: []sql.Row{
{"__DATABASE__mydb", false, "modified"},
{"__DATABASE__mydb", byte(0), "modified"},
},
},
{

View File

@@ -176,7 +176,7 @@ var MergeScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status;",
Expected: []sql.Row{
{"aTable", false, "constraint violation"},
{"aTable", byte(0), "constraint violation"},
},
},
{
@@ -513,7 +513,7 @@ var MergeScripts = []queries.ScriptTest{
},
{
Query: "SELECT * from dolt_status",
Expected: []sql.Row{{"test", true, "modified"}},
Expected: []sql.Row{{"test", byte(1), "modified"}},
},
{
Query: "SELECT COUNT(*) FROM dolt_log",
@@ -577,7 +577,7 @@ var MergeScripts = []queries.ScriptTest{
},
{
Query: "SELECT * from dolt_status",
Expected: []sql.Row{{"test", false, "modified"}, {"test", false, "conflict"}},
Expected: []sql.Row{{"test", byte(0), "modified"}, {"test", byte(0), "conflict"}},
},
{
Query: "SELECT COUNT(*) FROM dolt_log",
@@ -605,7 +605,7 @@ var MergeScripts = []queries.ScriptTest{
},
{
Query: "SELECT * from dolt_status",
Expected: []sql.Row{{"test", false, "modified"}},
Expected: []sql.Row{{"test", byte(0), "modified"}},
},
{
Query: "SELECT * from test ORDER BY pk",
@@ -682,7 +682,7 @@ var MergeScripts = []queries.ScriptTest{
},
{
Query: "SELECT * from dolt_status",
Expected: []sql.Row{{"test", false, "conflict"}},
Expected: []sql.Row{{"test", byte(0), "conflict"}},
},
{
Query: "SELECT COUNT(*) FROM dolt_log",
@@ -775,7 +775,7 @@ var MergeScripts = []queries.ScriptTest{
{
Skip: true,
Query: "SELECT * from dolt_status",
Expected: []sql.Row{{"test", false, "schema conflict"}},
Expected: []sql.Row{{"test", byte(0), "schema conflict"}},
},
{
Skip: true,
@@ -810,7 +810,7 @@ var MergeScripts = []queries.ScriptTest{
{
Skip: true,
Query: "SELECT * from dolt_status",
Expected: []sql.Row{{"test", true, "merged"}},
Expected: []sql.Row{{"test", byte(1), "merged"}},
},
{
Skip: true,
@@ -856,7 +856,7 @@ var MergeScripts = []queries.ScriptTest{
},
{
Query: "SELECT * FROM DOLT_STATUS",
Expected: []sql.Row{{"test", false, "modified"}, {"test", false, "conflict"}},
Expected: []sql.Row{{"test", byte(0), "modified"}, {"test", byte(0), "conflict"}},
},
{
// errors because creating a new branch implicitly commits the current transaction
@@ -1331,7 +1331,7 @@ var MergeScripts = []queries.ScriptTest{
},
{
Query: "SELECT * from dolt_status",
Expected: []sql.Row{{"test", false, "modified"}, {"test", false, "conflict"}},
Expected: []sql.Row{{"test", byte(0), "modified"}, {"test", byte(0), "conflict"}},
},
{
Query: "SELECT COUNT(*) FROM dolt_conflicts",
@@ -1580,7 +1580,7 @@ var MergeScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status;",
Expected: []sql.Row{
{"child", false, "constraint violation"},
{"child", byte(0), "constraint violation"},
},
},
},
@@ -1670,7 +1670,7 @@ var MergeScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status;",
Expected: []sql.Row{
{"t", false, "constraint violation"},
{"t", byte(0), "constraint violation"},
},
},
},
@@ -1708,7 +1708,7 @@ var MergeScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status;",
Expected: []sql.Row{
{"t", false, "constraint violation"},
{"t", byte(0), "constraint violation"},
},
},
},
@@ -1746,7 +1746,7 @@ var MergeScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status;",
Expected: []sql.Row{
{"t", false, "constraint violation"},
{"t", byte(0), "constraint violation"},
},
},
},
@@ -1784,7 +1784,7 @@ var MergeScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status;",
Expected: []sql.Row{
{"t", false, "constraint violation"},
{"t", byte(0), "constraint violation"},
},
},
},
@@ -4343,7 +4343,7 @@ var SchemaConflictScripts = []queries.ScriptTest{
{
Query: "select * from dolt_status",
Expected: []sql.Row{
{"t", false, "schema conflict"},
{"t", byte(0), "schema conflict"},
},
},
},

View File

@@ -135,7 +135,7 @@ var RevertScripts = []queries.ScriptTest{
},
{
Query: "select * from dolt_status",
Expected: []sql.Row{{"dont_track", false, "new table"}},
Expected: []sql.Row{{"dont_track", byte(0), "new table"}},
},
},
},

View File

@@ -140,8 +140,8 @@ var DoltRmTests = []queries.ScriptTest{
{
Query: "select * from dolt_status;",
Expected: []sql.Row{
{"test", true, "deleted"},
{"test", false, "new table"},
{"test", byte(1), "deleted"},
{"test", byte(0), "new table"},
},
},
},
@@ -160,7 +160,7 @@ var DoltRmTests = []queries.ScriptTest{
{
Query: "SELECT * FROM DOLT_STATUS",
Expected: []sql.Row{
{"test", false, "new table"},
{"test", byte(0), "new table"},
},
},
},
@@ -181,9 +181,9 @@ var DoltRmTests = []queries.ScriptTest{
{
Query: "SELECT * FROM dolt_status",
Expected: []sql.Row{
{"committed", true, "deleted"},
{"staged", false, "new table"},
{"committed", false, "new table"},
{"committed", byte(1), "deleted"},
{"staged", byte(0), "new table"},
{"committed", byte(0), "new table"},
},
},
},

View File

@@ -321,8 +321,8 @@ var DoltStashTests = []queries.ScriptTest{
{
Query: "SELECT * FROM DOLT_STATUS",
Expected: []sql.Row{
{"test", true, "modified"},
{"test", false, "modified"},
{"test", byte(1), "modified"},
{"test", byte(0), "modified"},
},
},
{
@@ -340,7 +340,7 @@ var DoltStashTests = []queries.ScriptTest{
{
Query: "SELECT * FROM dolt_status;",
Expected: []sql.Row{
{"test", false, "modified"},
{"test", byte(0), "modified"},
},
},
},
@@ -356,8 +356,8 @@ var DoltStashTests = []queries.ScriptTest{
{
Query: "SELECT * FROM DOLT_STATUS",
Expected: []sql.Row{
{"test", true, "new table"},
{"new", false, "new table"},
{"test", byte(1), "new table"},
{"new", byte(0), "new table"},
},
},
{
@@ -375,8 +375,8 @@ var DoltStashTests = []queries.ScriptTest{
{
Query: "SELECT * FROM dolt_status;",
Expected: []sql.Row{
{"test", true, "new table"},
{"new", false, "new table"},
{"test", byte(1), "new table"},
{"new", byte(0), "new table"},
},
},
},
@@ -393,9 +393,9 @@ var DoltStashTests = []queries.ScriptTest{
{
Query: "SELECT * FROM DOLT_STATUS",
Expected: []sql.Row{
{"new", true, "new table"},
{"test", false, "new table"},
{"new", false, "modified"},
{"new", byte(1), "new table"},
{"test", byte(0), "new table"},
{"new", byte(0), "modified"},
},
},
{
@@ -405,7 +405,7 @@ var DoltStashTests = []queries.ScriptTest{
{
Query: "SELECT * FROM DOLT_STATUS",
Expected: []sql.Row{
{"test", false, "new table"},
{"test", byte(0), "new table"},
},
},
{
@@ -415,8 +415,8 @@ var DoltStashTests = []queries.ScriptTest{
{
Query: "SELECT * FROM DOLT_STATUS",
Expected: []sql.Row{
{"new", true, "new table"},
{"test", false, "new table"},
{"new", byte(1), "new table"},
{"test", byte(0), "new table"},
},
},
},
@@ -432,7 +432,7 @@ var DoltStashTests = []queries.ScriptTest{
{
Query: "SELECT * FROM DOLT_STATUS;",
Expected: []sql.Row{
{"new_tab", false, "deleted"},
{"new_tab", byte(0), "deleted"},
},
},
{
@@ -521,7 +521,7 @@ var DoltStashTests = []queries.ScriptTest{
{
Query: "SELECT * FROM DOLT_STATUS",
Expected: []sql.Row{
{"test", false, "deleted"},
{"test", byte(0), "deleted"},
},
},
},

View File

@@ -1634,12 +1634,12 @@ var DoltStoredProcedureTransactionTests = []queries.TransactionTest{
{
// dirty working set: client a's changes were not committed to head
Query: "/* client a */ select * from dolt_status",
Expected: []sql.Row{{"users", false, "modified"}},
Expected: []sql.Row{{"users", byte(0), "modified"}},
},
{
// dirty working set: client a's changes were not committed to head, but are visible to client b
Query: "/* client b */ select * from dolt_status",
Expected: []sql.Row{{"users", false, "modified"}},
Expected: []sql.Row{{"users", byte(0), "modified"}},
},
{
Query: "/* client a */ select * from users order by id",
@@ -1716,14 +1716,14 @@ var DoltStoredProcedureTransactionTests = []queries.TransactionTest{
// dirty working set: modifications are staged
Query: "/* client a */ select * from dolt_status",
Expected: []sql.Row{
{"users", true, "modified"},
{"users", byte(1), "modified"},
},
},
{
// dirty working set: modifications are staged
Query: "/* client b */ select * from dolt_status",
Expected: []sql.Row{
{"users", true, "modified"},
{"users", byte(1), "modified"},
},
},
{
@@ -1804,16 +1804,16 @@ var DoltStoredProcedureTransactionTests = []queries.TransactionTest{
// dirty working set: modifications are staged and unstaged
Query: "/* client a */ select * from dolt_status",
Expected: []sql.Row{
{"users", true, "modified"},
{"users", false, "modified"},
{"users", byte(1), "modified"},
{"users", byte(0), "modified"},
},
},
{
// dirty working set: modifications are staged and unstaged
Query: "/* client b */ select * from dolt_status",
Expected: []sql.Row{
{"users", true, "modified"},
{"users", false, "modified"},
{"users", byte(1), "modified"},
{"users", byte(0), "modified"},
},
},
{
@@ -2036,16 +2036,16 @@ var DoltStoredProcedureTransactionTests = []queries.TransactionTest{
// working set has t2 new, t1 modified, nothing staged
Query: "/* client a */ select * from dolt_status",
Expected: []sql.Row{
{"t2", false, "new table"},
{"t1", false, "modified"},
{"t2", byte(0), "new table"},
{"t1", byte(0), "modified"},
},
},
{
// working set has t2 new, t1 modified, nothing staged
Query: "/* client b */ select * from dolt_status",
Expected: []sql.Row{
{"t2", false, "new table"},
{"t1", false, "modified"},
{"t2", byte(0), "new table"},
{"t1", byte(0), "modified"},
},
},
{

View File

@@ -3009,7 +3009,7 @@ SQL
run dolt sql -q "SELECT * from dolt_status" -r=csv
log_status_eq "0"
[[ "$output" =~ "table_name,staged,status" ]] || false
[[ "$output" =~ "aTable,false,constraint violation" ]] || false
[[ "$output" =~ "aTable,0,constraint violation" ]] || false
[[ "${#lines[@]}" = "2" ]] || false
run dolt sql -q "SELECT from_root_ish,violation_type,hex(dolt_row_hash) as dolt_row_hash,aColumn,bColumn,violation_info from dolt_constraint_violations_aTable" -r=csv

View File

@@ -538,7 +538,7 @@ SQL
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ "table_name,staged,status" ]] || false
[[ "$output" =~ "test,false,modified" ]] || false
[[ "$output" =~ "test,0,modified" ]] || false
run dolt filter-branch --apply-to-uncommitted -q "alter table test add column filter int"
[ "$status" -eq 0 ]
@@ -546,7 +546,7 @@ SQL
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ "table_name,staged,status" ]] || false
[[ "$output" =~ "test,false,modified" ]] || false
[[ "$output" =~ "test,0,modified" ]] || false
run dolt sql -r csv -q "select * from test as of 'HEAD'"
[ "$status" -eq 0 ]
@@ -564,7 +564,7 @@ SQL
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ "table_name,staged,status" ]] || false
[[ "$output" =~ "test,true,modified" ]] || false
[[ "$output" =~ "test,1,modified" ]] || false
run dolt filter-branch --apply-to-uncommitted -q "alter table test add column filter int"
[ "$status" -eq 0 ]
@@ -572,7 +572,7 @@ SQL
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ "table_name,staged,status" ]] || false
[[ "$output" =~ "test,true,modified" ]] || false
[[ "$output" =~ "test,1,modified" ]] || false
run dolt sql -r csv -q "select * from test as of 'HEAD'"
[ "$status" -eq 0 ]
@@ -598,7 +598,7 @@ SQL
run dolt sql -r csv -q "call dolt_checkout('other'); select * from dolt_status;"
[ "$status" -eq 0 ]
[[ "$output" =~ "table_name,staged,status" ]] || false
[[ "$output" =~ "test,false,modified" ]] || false
[[ "$output" =~ "test,0,modified" ]] || false
run dolt filter-branch --apply-to-uncommitted --branches -q "alter table test add column filter int"
[ "$status" -eq 0 ]
@@ -612,7 +612,7 @@ SQL
run dolt sql -r csv -q "call dolt_checkout('other'); select * from dolt_status;"
[ "$status" -eq 0 ]
[[ "$output" =~ "table_name,staged,status" ]] || false
[[ "$output" =~ "test,false,modified" ]] || false
[[ "$output" =~ "test,0,modified" ]] || false
run dolt sql -r csv -q "select * from test"
[ "$status" -eq 0 ]
@@ -647,7 +647,7 @@ SQL
run dolt sql -r csv -q "call dolt_checkout('other'); select * from dolt_status;"
[ "$status" -eq 0 ]
[[ "$output" =~ "table_name,staged,status" ]] || false
[[ "$output" =~ "test,true,modified" ]] || false
[[ "$output" =~ "test,1,modified" ]] || false
run dolt filter-branch --apply-to-uncommitted --branches -q "alter table test add column filter int"
[ "$status" -eq 0 ]
@@ -661,7 +661,7 @@ SQL
run dolt sql -r csv -q "call dolt_checkout('other'); select * from dolt_status;"
[ "$status" -eq 0 ]
[[ "$output" =~ "table_name,staged,status" ]] || false
[[ "$output" =~ "test,true,modified" ]] || false
[[ "$output" =~ "test,1,modified" ]] || false
run dolt sql -r csv -q "select * from test"
[ "$status" -eq 0 ]

View File

@@ -323,9 +323,9 @@ SQL
echo "$output"
! [[ "$output" =~ "test_table" ]] || false
run dolt sql -q "CALL DOLT_CHECKOUT('main'); SELECT * FROM dolt_status"
run dolt sql -r csv -q "CALL DOLT_CHECKOUT('main'); SELECT * FROM dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ "test_table | false" ]] || false
[[ "$output" =~ "test_table,0" ]] || false
}
@test "nonlocal: self-referrential nonlocal tables in the same branch as their target are effectively ignored" {
@@ -338,18 +338,18 @@ SQL
SQL
dolt add nonlocal_table
run dolt sql -q "select * from dolt_status"
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
echo "$output"
[[ "$output" =~ "nonlocal_table | true" ]] || false
[[ "$output" =~ "nonlocal_table,1" ]] || false
# Unstage nonlocal_table but keep it in the working set
dolt reset HEAD
dolt add .
run dolt sql -q "select * from dolt_status"
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ "nonlocal_table | true" ]] || false
[[ "$output" =~ "nonlocal_table,1" ]] || false
}
@test "nonlocal: adding an existing table to nonlocal tables errors" {

View File

@@ -306,7 +306,7 @@ select * from dolt_status;
SQL
[ $status -eq 0 ]
[[ "${lines[3]}" =~ "other" ]] || false
[[ "${lines[5]}" =~ "test,false,new table" ]] || false
[[ "${lines[5]}" =~ "test,0,new table" ]] || false
}
get_head_commit() {

View File

@@ -188,7 +188,7 @@ SQL
run dolt sql -r csv -q "select * from dolt_status;"
[ $status -eq 0 ]
[[ "$output" =~ 'test2,false,new table' ]] || false
[[ "$output" =~ 'test2,0,new table' ]] || false
# Now another partial commit
run dolt sql << SQL
@@ -215,7 +215,7 @@ SQL
run dolt sql -r csv -q "select * from dolt_status;"
[ $status -eq 0 ]
[[ "$output" =~ 'test,false,modified' ]] || false
[[ "$output" =~ 'test,0,modified' ]] || false
}
@test "sql-commit: The -f parameter is properly parsed and executes" {

View File

@@ -217,8 +217,9 @@ SQL
run dolt sql << SQL
INSERT INTO test VALUES (1);
call dolt_reset('--hard');
SELECT count(*)=0 FROM dolt_status;
SQL
run dolt sql -q "SELECT count(*)=0 FROM dolt_status"
[ $status -eq 0 ]
[[ "$output" =~ "true" ]] || false
}
@@ -243,10 +244,10 @@ INSERT INTO test VALUES (1);
SQL
dolt sql -q "call dolt_reset('test');"
run dolt sql -q "SELECT * FROM dolt_status;"
run dolt sql -r csv -q "SELECT * FROM dolt_status;"
[ $status -eq 0 ]
[[ "$output" =~ "false" ]] || false
[[ "$output" =~ "test,0,modified" ]] || false
}
@test "sql-reset: CALL DOLT_RESET soft maintains staged session variable" {
@@ -298,10 +299,10 @@ SQL
run dolt sql -q "call dolt_reset('--hard')"
[ "$status" -eq 0 ]
run dolt sql -q "select * from dolt_status"
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ "| dolt_ignore | false | new table |" ]] || false
[ "${#lines[@]}" -eq 6 ]
[[ "$output" =~ "dolt_ignore,0,new table" ]] || false
[ "${#lines[@]}" -eq 3 ]
run dolt sql -q "select * from test2"
[ "$status" -eq 0 ]

View File

@@ -25,13 +25,13 @@ teardown() {
@test "sql-status: status properly works with working and staged tables" {
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ 'test,false,new table' ]] || false
[[ "$output" =~ 'test,0,new table' ]] || false
dolt add .
# Confirm table is now marked as staged
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ 'test,true,new table' ]] || false
[[ "$output" =~ 'test,1,new table' ]] || false
}
@test "sql-status: status properly works with table rename" {
@@ -39,7 +39,7 @@ teardown() {
dolt add test
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ 'test,true,new table' ]] || false
[[ "$output" =~ 'test,1,new table' ]] || false
# Rename test to test2
run dolt sql -r csv -q "alter table test rename to test2"
@@ -48,14 +48,14 @@ teardown() {
# Confirm table is now marked as renamed, test still staged
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ 'test,true,new table' ]] || false
[[ "$output" =~ 'test -> test2,false,renamed' ]] || false
[[ "$output" =~ 'test,1,new table' ]] || false
[[ "$output" =~ 'test -> test2,0,renamed' ]] || false
# Confirm table is now marked as staged
dolt add test2
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ 'test2,true,new table' ]] || false
[[ "$output" =~ 'test2,1,new table' ]] || false
}
@test "sql-status: table that has staged and unstaged changes shows up twice" {
@@ -68,8 +68,8 @@ teardown() {
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ 'test,true,new table' ]] || false
[[ "$output" =~ 'test,false,modified' ]] || false
[[ "$output" =~ 'test,1,new table' ]] || false
[[ "$output" =~ 'test,0,modified' ]] || false
}
@test "sql-status: status properly works with docs" {
@@ -78,10 +78,9 @@ teardown() {
echo license-text > LICENSE.md
dolt docs upload LICENSE.md LICENSE.md
dolt sql -r csv -q "select * from dolt_status ORDER BY table_name"
run dolt sql -r csv -q "select * from dolt_status ORDER BY table_name"
[ "$status" -eq 0 ]
[[ "$output" =~ 'dolt_docs,false,new table' ]] || false
[[ "$output" =~ 'dolt_docs,0,new table' ]] || false
}
@test "sql-status: status works property with working tables in conflict" {
@@ -104,7 +103,7 @@ teardown() {
run dolt sql -r csv -q "select * from dolt_status"
[ "$status" -eq 0 ]
[[ "$output" =~ 'test,false,conflict' ]] || false
[[ "$output" =~ 'test,0,conflict' ]] || false
}
@test "sql-status: status works properly with working docs in conflict" {
@@ -149,7 +148,7 @@ teardown() {
dolt status
run dolt sql -r csv -q "select * from dolt_status ORDER BY status"
[ "$status" -eq 0 ]
[[ "$output" =~ 'dolt_docs,false,conflict' ]] || false
[[ "$output" =~ 'dolt_docs,0,conflict' ]] || false
}
@test "sql-status: tables with no observable changes don't show in status but can be staged" {
@@ -164,10 +163,9 @@ insert into temp__t1 values (1);
drop table t1;
rename table temp__t1 to t1;
SQL
dolt sql -q "select * from dolt_status;"
run dolt sql -q "select * from dolt_status;"
run dolt sql -q "select count(*)=0 from dolt_status;"
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 0 ]
[[ "$output" =~ "true" ]] || false
run dolt diff t1
[ "$status" -eq 0 ]
@@ -177,5 +175,5 @@ SQL
run dolt sql -r csv -q "select * from dolt_status;"
[ "$status" -eq 0 ]
[[ "$output" =~ "t1,true,modified" ]] || false
[[ "$output" =~ "t1,1,modified" ]] || false
}