Skip to content

Commit

Permalink
Merge pull request #35 from liquidata-inc/km/dolt/fix-ancestor-spelling
Browse files Browse the repository at this point in the history
dolt/go: Fix spelling on ancestor
  • Loading branch information
Katie McCulloch committed Aug 19, 2019
2 parents e53f027 + 92e246e commit fae0388
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go/cmd/dolt/commands/utils.go
Expand Up @@ -102,7 +102,7 @@ func ResolveCommitWithVErr(dEnv *env.DoltEnv, cSpecStr, cwb string) (*doltdb.Com
cm, err := dEnv.DoltDB.Resolve(context.TODO(), cs)

if err != nil {
if err == doltdb.ErrInvalidAnscestorSpec {
if err == doltdb.ErrInvalidAncestorSpec {
return nil, errhand.BuildDError("'%s' is an invalid ancestor spec", cs.ASpec.SpecStr).Build()
} else if doltdb.IsNotFoundErr(err) {
return nil, errhand.BuildDError("'%s' not found", cSpecStr).Build()
Expand Down
2 changes: 1 addition & 1 deletion go/libraries/doltcore/doltdb/anscestor_spec_test.go
Expand Up @@ -50,7 +50,7 @@ func TestParseInstructions(t *testing.T) {
}
}

func TestSplitAnscestorSpec(t *testing.T) {
func TestSplitAncestorSpec(t *testing.T) {
tests := []struct {
inputStr string
expectedCSpecStr string
Expand Down
10 changes: 5 additions & 5 deletions go/libraries/doltcore/doltdb/commit.go
Expand Up @@ -165,9 +165,9 @@ func (c *Commit) GetRootValue() (*RootValue, error) {
return nil, errHasNoRootValue
}

var ErrNoCommonAnscestor = errors.New("no common anscestor")
var ErrNoCommonAncestor = errors.New("no common ancestor")

func GetCommitAnscestor(ctx context.Context, cm1, cm2 *Commit) (*Commit, error) {
func GetCommitAncestor(ctx context.Context, cm1, cm2 *Commit) (*Commit, error) {
ref1, err := types.NewRef(cm1.commitSt, cm1.vrw.Format())

if err != nil {
Expand Down Expand Up @@ -209,14 +209,14 @@ func getCommitAncestorRef(ctx context.Context, ref1, ref2 types.Ref, vrw types.V
}

if !ok {
return types.Ref{}, ErrNoCommonAnscestor
return types.Ref{}, ErrNoCommonAncestor
}

return ancestorRef, nil
}

func (c *Commit) CanFastForwardTo(ctx context.Context, new *Commit) (bool, error) {
ancestor, err := GetCommitAnscestor(ctx, c, new)
ancestor, err := GetCommitAncestor(ctx, c, new)

if err != nil {
return false, err
Expand All @@ -235,7 +235,7 @@ func (c *Commit) CanFastForwardTo(ctx context.Context, new *Commit) (bool, error
}

func (c *Commit) CanFastReverseTo(ctx context.Context, new *Commit) (bool, error) {
ancestor, err := GetCommitAnscestor(ctx, c, new)
ancestor, err := GetCommitAncestor(ctx, c, new)

if err != nil {
return false, err
Expand Down
4 changes: 2 additions & 2 deletions go/libraries/doltcore/doltdb/doltdb.go
Expand Up @@ -242,11 +242,11 @@ func walkAncestorSpec(ctx context.Context, db datas.Database, commitSt types.Str
}

if commitStPtr == nil {
return types.EmptyStruct(db.Format()), ErrInvalidAnscestorSpec
return types.EmptyStruct(db.Format()), ErrInvalidAncestorSpec
}
commitSt = *commitStPtr
} else {
return types.EmptyStruct(db.Format()), ErrInvalidAnscestorSpec
return types.EmptyStruct(db.Format()), ErrInvalidAncestorSpec
}
}

Expand Down
4 changes: 2 additions & 2 deletions go/libraries/doltcore/doltdb/errors.go
Expand Up @@ -19,7 +19,7 @@ import "errors"
var ErrInvBranchName = errors.New("not a valid user branch name")
var ErrInvTableName = errors.New("not a valid table name")
var ErrInvHash = errors.New("not a valid hash")
var ErrInvalidAnscestorSpec = errors.New("invalid anscestor spec")
var ErrInvalidAncestorSpec = errors.New("invalid ancestor spec")
var ErrInvalidBranchOrHash = errors.New("string is not a valid branch or hash")

var ErrFoundHashNotACommit = errors.New("the value retrieved for this hash is not a commit")
Expand All @@ -39,7 +39,7 @@ var ErrIsBehind = errors.New("cannot reverse from b to a. b is a is behind a alr

func IsInvalidFormatErr(err error) bool {
switch err {
case ErrInvBranchName, ErrInvTableName, ErrInvHash, ErrInvalidAnscestorSpec, ErrInvalidBranchOrHash:
case ErrInvBranchName, ErrInvTableName, ErrInvHash, ErrInvalidAncestorSpec, ErrInvalidBranchOrHash:
return true
default:
return false
Expand Down
2 changes: 1 addition & 1 deletion go/libraries/doltcore/merge/merge.go
Expand Up @@ -41,7 +41,7 @@ type Merger struct {
}

func NewMerger(ctx context.Context, commit, mergeCommit *doltdb.Commit, vrw types.ValueReadWriter) (*Merger, error) {
ancestor, err := doltdb.GetCommitAnscestor(ctx, commit, mergeCommit)
ancestor, err := doltdb.GetCommitAncestor(ctx, commit, mergeCommit)

if err != nil {
return nil, err
Expand Down

0 comments on commit fae0388

Please sign in to comment.