removed redundant checks

This commit is contained in:
Zach Musgrave
2026-02-11 12:25:07 -08:00
parent a4fe359725
commit 44e4bec19e
2 changed files with 18 additions and 31 deletions

View File

@@ -113,8 +113,6 @@ func TableFromAddr(ctx context.Context, vrw types.ValueReadWriter, ns tree.NodeS
}
// VrwFromTable returns the types.ValueReadWriter used by |t|.
// todo(andy): this is a temporary method that will be removed when there is a
// general-purpose abstraction to replace types.ValueReadWriter.
func VrwFromTable(t Table) types.ValueReadWriter {
ddt := t.(doltDevTable)
return ddt.vrw

View File

@@ -39,10 +39,10 @@ var ErrSchemaConflict = goerrors.NewKind("schema conflict found, merge aborted.
// to merge sets of conflicts together, we need to abort the merge at this
// point.
var ErrCantOverwriteConflicts = errors.New("existing unresolved conflicts would be" +
" overridden by new conflicts produced by merge. Please resolve them and try again")
" overridden by new conflicts produced by merge. Please resolve them and try again")
var ErrConflictsIncompatible = errors.New("the existing conflicts are of a different schema" +
" than the conflicts generated by this merge. Please resolve them and try again")
" than the conflicts generated by this merge. Please resolve them and try again")
var ErrMultipleViolationsForRow = errors.New("multiple violations for row not supported")
@@ -167,12 +167,12 @@ func SchemaConflictTableNames(sc []SchemaConflict) (tables []doltdb.TableName) {
// key any artifacts generated by this merge. |ancRootIsh| is similar and is
// used to retrieve the base value for a conflict.
func MergeRoots(
ctx *sql.Context,
tableResolver doltdb.TableResolver,
ourRoot, theirRoot, ancRoot doltdb.RootValue,
theirs, ancestor doltdb.Rootish,
opts editor.Options,
mergeOpts MergeOpts,
ctx *sql.Context,
tableResolver doltdb.TableResolver,
ourRoot, theirRoot, ancRoot doltdb.RootValue,
theirs, ancestor doltdb.Rootish,
opts editor.Options,
mergeOpts MergeOpts,
) (*Result, error) {
var (
nbf *types.NomsBinFormat
@@ -180,9 +180,7 @@ func MergeRoots(
)
nbf = ourRoot.VRW().Format()
if !types.IsFormat_DOLT(nbf) {
panic("unsupported format: " + nbf.VersionString())
}
types.AssertFormat_DOLT(nbf)
// merge collations
oColl, err := ourRoot.GetCollation(ctx)
@@ -281,12 +279,7 @@ func MergeRoots(
continue
}
if mergedTable.conflict.Count() > 0 {
if types.IsFormat_DOLT(nbf) {
schConflicts = append(schConflicts, mergedTable.conflict)
} else {
// return schema conflict as error
return nil, mergedTable.conflict
}
schConflicts = append(schConflicts, mergedTable.conflict)
}
if mergedTable.table != nil {
@@ -384,20 +377,16 @@ func MergeRoots(
return nil, err
}
if types.IsFormat_DOLT(ourRoot.VRW().Format()) {
err = getConstraintViolationStats(ctx, mergedRoot, tblToStats)
if err != nil {
return nil, err
}
return &Result{
Root: mergedRoot,
SchemaConflicts: schConflicts,
Stats: tblToStats,
}, nil
err = getConstraintViolationStats(ctx, mergedRoot, tblToStats)
if err != nil {
return nil, err
}
panic("Unsupported format: " + ourRoot.VRW().Format().VersionString())
return &Result{
Root: mergedRoot,
SchemaConflicts: schConflicts,
Stats: tblToStats,
}, nil
}
// populates tblToStats with violation statistics