Skip to content

Commit

Permalink
go: env/actions/branch: Fix error message for invalid branch name giv…
Browse files Browse the repository at this point in the history
…en to create branch.
  • Loading branch information
reltuk committed Feb 15, 2022
1 parent f2fa2fa commit 27348e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions go/libraries/doltcore/env/actions/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ func CreateBranchWithStartPt(ctx context.Context, dbData env.DbData, newBranch,
}

func CreateBranchOnDB(ctx context.Context, ddb *doltdb.DoltDB, newBranch, startingPoint string, force bool, headRef ref.DoltRef) error {
if !doltdb.IsValidUserBranchName(newBranch) {
return doltdb.ErrInvBranchName
}

branchRef := ref.NewBranchRef(newBranch)
hasRef, err := ddb.HasRef(ctx, branchRef)
if err != nil {
Expand All @@ -213,10 +217,6 @@ func CreateBranchOnDB(ctx context.Context, ddb *doltdb.DoltDB, newBranch, starti
return ErrAlreadyExists
}

if !doltdb.IsValidUserBranchName(newBranch) {
return doltdb.ErrInvBranchName
}

cs, err := doltdb.NewCommitSpec(startingPoint)
if err != nil {
return err
Expand Down

0 comments on commit 27348e2

Please sign in to comment.