-
-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Error Handling for Tags #8382
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
return "", err | ||
} else if isTag && apr.Contains(cli.MoveFlag) { | ||
return "", fmt.Errorf(`dolt does not support a detached head state. To checkout a tag, run: | ||
dolt checkout %s -b {new_branch_namee}`, branchName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dolt checkout %s -b {new_branch_namee}`, branchName) | |
dolt checkout %s -b {new_branch_name}`, branchName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice error message btw! Really, really helpful to tell users exactly what command they need to run whenever we can.
@@ -290,11 +290,15 @@ func checkoutRemoteBranch(ctx *sql.Context, dSess *dsess.DoltSession, dbName str | |||
} | |||
|
|||
if len(remoteRefs) == 0 { | |||
if isTag, err := actions.IsTag(ctx, dbData.Ddb, branchName); err != nil { | |||
return "", err | |||
} else if isTag && apr.Contains(cli.MoveFlag) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to only execute this logic to when cli.MoveFlag
is present? My understanding is that we don't document the MoveFlag
, but the CLI uses it when it calls dolt_checkout()
to move the working set contents? It seems like we'd want to return the same error message if you tried to check out a tag from the SQL interface, too, right? I may just be missing something on how the MoveFlag
is used though.
}, | ||
{ | ||
Query: "call dolt_checkout('v1');", | ||
ExpectedErrStr: "error: could not find v1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) Might be nice if there was a more prescriptive error message here, like we use in dolt checkout
to tell the user exactly what they need to run in order to checkout a tag as a new branch.
@coffeegoddd DOLT
|
Changes:
--branch
optionFixes: #8377