mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-09 18:59:12 -06:00
Somewhat hacky fix to get commit hash qualified DBs working
This commit is contained in:
@@ -1036,6 +1036,23 @@ func (sess *Session) AddDB(ctx *sql.Context, dbState InitialDbState) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
headRoot, err := dbState.HeadCommit.GetRootValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
hash, err := headRoot.HashOf()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = sess.Session.SetSessionVariable(ctx, WorkingKey(db.Name()), hash.String())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sessionState.headRoot = headRoot
|
||||
}
|
||||
|
||||
// This has to happen after SetRoot above, since it does a stale check before its work
|
||||
|
||||
@@ -606,7 +606,7 @@ SQL
|
||||
# get the second to last commit hash
|
||||
hash=`dolt log | grep commit | cut -d" " -f2 | tail -n+2 | head -n1`
|
||||
|
||||
dolt sql -q "select * from \`dolt_repo_$$/$hash\`.a1 order by x;" -r csv
|
||||
run dolt sql -q "select * from \`dolt_repo_$$/$hash\`.a1 order by x;" -r csv
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 4 ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user