Skip to content

Commit

Permalink
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
Browse files Browse the repository at this point in the history
…te.sh
  • Loading branch information
zachmu committed Oct 12, 2024
1 parent ad154f1 commit 5734023
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
25 changes: 13 additions & 12 deletions go/libraries/doltcore/sqle/dprocedures/dolt_checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import (
"errors"
"fmt"

"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"

"github.com/dolthub/dolt/go/cmd/dolt/cli"
"github.com/dolthub/dolt/go/cmd/dolt/errhand"
"github.com/dolthub/dolt/go/libraries/doltcore/doltdb"
Expand All @@ -28,8 +31,6 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/resolve"
"github.com/dolthub/dolt/go/libraries/utils/argparser"
"github.com/dolthub/dolt/go/store/hash"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
)

var ErrEmptyBranchName = errors.New("error: cannot checkout empty string")
Expand Down Expand Up @@ -130,7 +131,7 @@ func doDoltCheckout(ctx *sql.Context, args []string) (statusCode int, successMes
if apr.NArg() > 1 {
database := ctx.GetCurrentDatabase()
if database == "" {
return 1, "", sql.ErrNoDatabaseSelected.New()
return 1, "", sql.ErrNoDatabaseSelected.New()
}
err = checkoutTablesFromCommit(ctx, database, branchName, apr.Args[1:])
if err != nil {
Expand Down Expand Up @@ -494,13 +495,13 @@ func checkoutExistingBranch(ctx *sql.Context, dbName string, branchName string,
return nil
}

// checkoutTablesFromCommit checks out the tables named from the branch named and overwrites those tables in the
// checkoutTablesFromCommit checks out the tables named from the branch named and overwrites those tables in the
// staged and working roots.
func checkoutTablesFromCommit(
ctx *sql.Context,
databaseName string,
commitRef string,
tables []string,
ctx *sql.Context,
databaseName string,
commitRef string,
tables []string,
) error {
dSess := dsess.DSessFromSess(ctx.Session)
dbData, ok := dSess.GetDbData(ctx, databaseName)
Expand Down Expand Up @@ -530,7 +531,7 @@ func checkoutTablesFromCommit(
if !ok {
return fmt.Errorf("HEAD is not a commit")
}

headRoot, err := cm.GetRootValue(ctx)
if err != nil {
return err
Expand All @@ -540,7 +541,7 @@ func checkoutTablesFromCommit(
if err != nil {
return err
}

var tableNames []doltdb.TableName
if len(tables) == 1 && tables[0] == "." {
tableNames, err = doltdb.UnionTableNames(ctx, ws.WorkingRoot())
Expand All @@ -550,7 +551,7 @@ func checkoutTablesFromCommit(
} else {
tableNames = make([]doltdb.TableName, len(tables))
for i, table := range tables {
// TODO: we should allow schema-qualified table names here as well
// TODO: we should allow schema-qualified table names here as well
name, _, tableExistsInHead, err := resolve.Table(ctx, headRoot, table)
if err != nil {
return err
Expand Down Expand Up @@ -581,7 +582,7 @@ func doGlobalCheckout(ctx *sql.Context, branchName string, isForce bool, isNewBr
return nil
}

// checkoutTablesFromHead checks out the tables named from the current head and overwrites those tables in the
// checkoutTablesFromHead checks out the tables named from the current head and overwrites those tables in the
// working root. The working root is then set as the new staged root.
func checkoutTablesFromHead(ctx *sql.Context, roots doltdb.Roots, name string, tables []string) error {
tableNames := make([]doltdb.TableName, len(tables))
Expand Down
3 changes: 1 addition & 2 deletions go/libraries/doltcore/sqle/enginetest/dolt_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ func TestSchemaOverrides(t *testing.T) {
func TestSingleScript(t *testing.T) {
t.Skip()

var scripts = []queries.ScriptTest{
}
var scripts = []queries.ScriptTest{}

for _, script := range scripts {
harness := newDoltHarness(t)
Expand Down
10 changes: 5 additions & 5 deletions go/libraries/doltcore/sqle/enginetest/dolt_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -3284,11 +3284,11 @@ var DoltCheckoutScripts = []queries.ScriptTest{
},
},
{
Query: "select * from t1 order by 1",
Query: "select * from t1 order by 1",
Expected: []sql.Row{},
},
{
Query: "select * from t2 order by 1",
Query: "select * from t2 order by 1",
Expected: []sql.Row{},
},
{
Expand All @@ -3305,7 +3305,7 @@ var DoltCheckoutScripts = []queries.ScriptTest{
},
},
{
Query: "SET @commit1 = (select commit_hash from dolt_log order by date desc limit 1);",
Query: "SET @commit1 = (select commit_hash from dolt_log order by date desc limit 1);",
Expected: []sql.Row{{}},
},
{
Expand All @@ -3328,11 +3328,11 @@ var DoltCheckoutScripts = []queries.ScriptTest{
},
},
{
Query: "call dolt_checkout('nosuchbranch', 't1')",
Query: "call dolt_checkout('nosuchbranch', 't1')",
ExpectedErrStr: "branch not found: nosuchbranch",
},
{
Query: "call dolt_checkout('HEAD', 't3')",
Query: "call dolt_checkout('HEAD', 't3')",
ExpectedErrStr: "table t3 does not exist in HEAD",
},
},
Expand Down

0 comments on commit 5734023

Please sign in to comment.