mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-05 11:21:58 -05:00
dolt_checkout and read replication working set fixes (#3808)
* dolt_checkout and read replication working set fixes
Sql path 'dolt_checkout' used to create a new branch from HEAD
if the checkout name did not have a remote tracking ref. The CLI,
on the other hand, will initialize a local branch if a remote tracking
ref with the same name in the default remote exists. The SQl path
now mirrors the CLI checkout: if we checkout a new branch, like
'new_feature', and we have previously fetched that branch from our
default remote, `dolt_checkout('feature')` will initialize a branch
using the head commit from the remote `feature`.
Second, read replication was creating a local tracking branch for
remote branches (sourced from the master remote), but not creating
corresponding working sets. This let users attach to new branches with
`use db/feature` syntax, but prevented users from
`dolt_checkout('feature')` both for the bug in dolt checkout, but also
because we created an intermediary state with a local branch, but
without a corresponding working set. SQL replication will now fetch,
create the new branch, and create the appropriate working set.
* jennifer's feedback
* unskip
This commit is contained in:
committed by
GitHub
parent
93a2938716
commit
3ec0e48b0d
@@ -232,6 +232,23 @@ teardown() {
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-pull: CALL dolt_checkout after dolt_fetch a new feature branch" {
|
||||
cd repo1
|
||||
dolt checkout -b feature2
|
||||
dolt sql -q "create table t2 (i int primary key);"
|
||||
dolt sql -q "call dolt_commit('-am', 'create t2')"
|
||||
dolt push --set-upstream origin feature2
|
||||
|
||||
cd ../repo2
|
||||
dolt sql -q "CALL dolt_fetch('origin', 'feature2')"
|
||||
run dolt sql -q "call dolt_checkout('feature2'); show tables" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 5 ]
|
||||
[[ "$output" =~ "Table" ]] || false
|
||||
[[ "$output" =~ "t1" ]] || false
|
||||
[[ "$output" =~ "t2" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-pull: dolt_pull force" {
|
||||
skip "todo: support dolt pull --force (cli too)"
|
||||
cd repo2
|
||||
|
||||
Reference in New Issue
Block a user