mirror of
https://github.com/dolthub/dolt.git
synced 2025-12-30 08:50:01 -06:00
Merge main
This commit is contained in:
6
go/libraries/doltcore/env/actions/staged.go
vendored
6
go/libraries/doltcore/env/actions/staged.go
vendored
@@ -17,6 +17,7 @@ package actions
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/diff"
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
|
||||
@@ -47,7 +48,7 @@ func StageAllTables(ctx context.Context, roots doltdb.Roots, filterIgnoredTables
|
||||
return StageTables(ctx, roots, tbls, filterIgnoredTables)
|
||||
}
|
||||
|
||||
func StageDatabase(ctx context.Context, roots doltdb.Roots, filterIgnoredTables bool) (doltdb.Roots, error) {
|
||||
func StageDatabase(ctx context.Context, roots doltdb.Roots) (doltdb.Roots, error) {
|
||||
wColl, err := roots.Working.GetCollation(ctx)
|
||||
if err != nil {
|
||||
return doltdb.Roots{}, err
|
||||
@@ -74,6 +75,9 @@ func StageModifiedAndDeletedTables(ctx context.Context, roots doltdb.Roots) (dol
|
||||
|
||||
var tbls []doltdb.TableName
|
||||
for _, tableDelta := range unstaged {
|
||||
if strings.HasPrefix(tableDelta.FromName.Name, diff.DBPrefix) {
|
||||
continue
|
||||
}
|
||||
if !tableDelta.IsAdd() {
|
||||
tbls = append(tbls, tableDelta.FromName)
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func doDoltAdd(ctx *sql.Context, args []string) (int, error) {
|
||||
return 1, err
|
||||
}
|
||||
|
||||
roots, err = actions.StageDatabase(ctx, roots, !apr.Contains(cli.ForceFlag))
|
||||
roots, err = actions.StageDatabase(ctx, roots)
|
||||
if err != nil {
|
||||
return 1, err
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func doDoltAdd(ctx *sql.Context, args []string) (int, error) {
|
||||
}
|
||||
// remove from slice
|
||||
apr.Args = append(apr.Args[:i], apr.Args[i+1:]...)
|
||||
roots, err = actions.StageDatabase(ctx, roots, !apr.Contains(cli.ForceFlag))
|
||||
roots, err = actions.StageDatabase(ctx, roots)
|
||||
if err != nil {
|
||||
return 1, err
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ func doDoltCommit(ctx *sql.Context, args []string) (string, bool, error) {
|
||||
if err != nil {
|
||||
return "", false, fmt.Errorf(err.Error())
|
||||
}
|
||||
roots, err = actions.StageDatabase(ctx, roots, true)
|
||||
roots, err = actions.StageDatabase(ctx, roots)
|
||||
if err != nil {
|
||||
return "", false, fmt.Errorf(err.Error())
|
||||
}
|
||||
@@ -95,6 +95,10 @@ func doDoltCommit(ctx *sql.Context, args []string) (string, bool, error) {
|
||||
if err != nil {
|
||||
return "", false, fmt.Errorf(err.Error())
|
||||
}
|
||||
roots, err = actions.StageDatabase(ctx, roots)
|
||||
if err != nil {
|
||||
return "", false, fmt.Errorf(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
var name, email string
|
||||
|
||||
@@ -63,6 +63,19 @@ teardown() {
|
||||
[[ "$output" =~ "| 1" ]] || false
|
||||
}
|
||||
|
||||
@test "commit: --all (-a) adds changed database collation" {
|
||||
dolt sql -q "create database colldb"
|
||||
cd colldb
|
||||
|
||||
dolt sql -q "alter database colldb collate utf8mb4_spanish_ci"
|
||||
dolt commit -a -m "collation"
|
||||
|
||||
run dolt status
|
||||
[ $status -eq 0 ]
|
||||
[[ "$output" =~ "On branch main" ]] || false
|
||||
[[ "$output" =~ "nothing to commit, working tree clean" ]] || false
|
||||
}
|
||||
|
||||
@test "commit: -m sets commit message properly" {
|
||||
dolt sql -q "CREATE table t1 (pk int primary key);"
|
||||
dolt add t1
|
||||
|
||||
Reference in New Issue
Block a user