updates dolt commit to properly display skip empty commit message

This commit is contained in:
Stephanie You
2023-06-15 17:41:07 -07:00
parent a803adbc9a
commit 65719c7246
2 changed files with 11 additions and 3 deletions
+9 -2
View File
@@ -158,14 +158,21 @@ func performCommit(ctx context.Context, commandStr string, args []string, cliCtx
return 1, false return 1, false
} }
_, _, err = queryist.Query(sqlCtx, q) schema, rowIter, err := queryist.Query(sqlCtx, q)
if err != nil { if err != nil {
cli.Println(err.Error()) cli.Println(err.Error())
return 1, false return 1, false
} }
resultRow, err := sql.RowIterToRows(sqlCtx, schema, rowIter)
if err != nil {
return 0, false
}
if resultRow == nil {
return 0, true
}
// TODO: when dolt log is migrated, remove this block printing out the commit and print with a dolt log call in Exec() // TODO: when dolt log is migrated, remove this block printing out the commit and print with a dolt log call in Exec()
schema, rowIter, err := queryist.Query(sqlCtx, "select * from dolt_log() limit 1") schema, rowIter, err = queryist.Query(sqlCtx, "select * from dolt_log() limit 1")
if err != nil { if err != nil {
cli.Println(err.Error()) cli.Println(err.Error())
return 1, false return 1, false
+2 -1
View File
@@ -110,8 +110,9 @@ teardown() {
[ $original_head != $new_head ] [ $original_head != $new_head ]
# When no changes are staged, --skip-empty skips creating the commit # When no changes are staged, --skip-empty skips creating the commit
dolt commit --skip-empty -m "commit message" run dolt commit --skip-empty -m "commit message"
[ $new_head = $(get_head_commit) ] [ $new_head = $(get_head_commit) ]
[[ "$output" =~ "Skipping empty commit" ]] || false
} }
@test "commit: -f works correctly" { @test "commit: -f works correctly" {