diff --git a/go/cmd/dolt/commands/ls.go b/go/cmd/dolt/commands/ls.go index c6695146b5..fae751d76e 100644 --- a/go/cmd/dolt/commands/ls.go +++ b/go/cmd/dolt/commands/ls.go @@ -172,24 +172,25 @@ func printUserTables(ctx context.Context, root *doltdb.RootValue, label string, func listTableVerbose(ctx context.Context, tbl string, root *doltdb.RootValue) (string, errhand.VerboseError) { h, _, err := root.GetTableHash(ctx, tbl) - if err != nil { return "", errhand.BuildDError("error: failed to get table hash").AddCause(err).Build() } tblVal, _, err := root.GetTable(ctx, tbl) - if err != nil { return "", errhand.BuildDError("error: failed to get table").AddCause(err).Build() } - rows, err := tblVal.GetNomsRowData(ctx) - + rows, err := tblVal.GetRowData(ctx) if err != nil { return "", errhand.BuildDError("error: failed to get row data").AddCause(err).Build() } + cnt, err := rows.Count() + if err != nil { + return "", errhand.VerboseErrorFromError(err) + } - return fmt.Sprintf("\t%-32s %s %d rows\n", tbl, h.String(), rows.Len()), nil + return fmt.Sprintf("\t%-32s %s %d rows\n", tbl, h.String(), cnt), nil } func printSystemTables(ctx context.Context, root *doltdb.RootValue, ddb *doltdb.DoltDB, verbose bool) errhand.VerboseError { diff --git a/integration-tests/bats/1pk5col-ints.bats b/integration-tests/bats/1pk5col-ints.bats index ae901e37e2..10c488247c 100755 --- a/integration-tests/bats/1pk5col-ints.bats +++ b/integration-tests/bats/1pk5col-ints.bats @@ -27,6 +27,10 @@ teardown() { run dolt ls [ "$status" -eq 0 ] [[ "${lines[1]}" =~ "test" ]] || false + run dolt ls --verbose + [ "$status" -eq 0 ] + [[ "${lines[1]}" =~ "0 rows" ]] || false + run dolt sql -q "select * from test" [ "$status" -eq 0 ] [[ "$output" =~ pk[[:space:]]+\|[[:space:]]+c1[[:space:]]+\|[[:space:]]+c2[[:space:]]+\|[[:space:]]+c3[[:space:]]+\|[[:space:]]+c4[[:space:]]+\|[[:space:]]+c5 ]] || false