Fix 483 unable to checkout table(s)/branch(s) with same name#9371
Fix 483 unable to checkout table(s)/branch(s) with same name#9371
Conversation
|
@coffeegoddd DOLT
|
0631c39 to
7587982
Compare
|
Extra issue I found though I didn't handle since they weren't relevant to this one:
|
|
@coffeegoddd DOLT
|
d2316fe to
662b7a4
Compare
|
@coffeegoddd DOLT
|
1d251bb to
c919512
Compare
|
@coffeegoddd DOLT
|
b1d1e9d to
1c0a523
Compare
|
@coffeegoddd DOLT
|
4518931 to
5b4d2f4
Compare
|
@coffeegoddd DOLT
|
83507fd to
05b3bff
Compare
|
@coffeegoddd DOLT
|
zachmu
left a comment
There was a problem hiding this comment.
LGTM, see comments.
You should also add some spot checks to make sure these work in the SQL context for the dolt_checkout procedure. There's a dolt_queries.go file with lots of checkout tests in it.
| dolt checkout main | ||
|
|
||
| # Use explicit branch reference | ||
| dolt checkout feature -- |
There was a problem hiding this comment.
This answers my question from the code, didn't know about this syntax. Good to make that explicit in the code
f2ec13f to
72cbbbd
Compare
e69bc56 to
cd81f2f
Compare
|
@coffeegoddd DOLT
|
Fixes: #483
Local/remote refs take priority in Do What I Mean (DWIM) scenarios where
dolthas to interpret ambiguous input incheckout.If a table and tracking branch share the same name, but local does not exist an error will occur.
--can now be used to clear up ambiguity.case 1:
dolt checkout <ref> -- [<tables>]<ref>must be a singular valid tree, everything else after '--' must be a table.case 2:
dolt checkout -- [<tables>]This is case 1 but without
<ref>.case 3:
git checkout <something> [--](a) If is a commit switch to branch.
(b) If isn’t a commit, and either "--" is present or isn’t a table, no -t or -b is given, and there’s a tracking branch named on exactly one remote (or on the specified remote), then this acts as shorthand to fork local from that remote-tracking branch.
(c) Otherwise, if "--" is present, treat it like case 1.
(d) Otherwise, if a ref treat it like case 1. If a table treat like case 2. If neither fail.
case 4:
git checkout <something> <tables>The first argument must not be ambiguous. If a
<ref>follow case 1, if a table follow case 2. Otherwise, fail.