Add clarifying TODO to GetWorkingSet.

This commit is contained in:
Nick Tobey
2023-05-17 11:14:37 -07:00
parent 0a632eb8ce
commit 9226024961
+3 -1
View File
@@ -651,7 +651,9 @@ func (db Database) GetRoot(ctx *sql.Context) (*doltdb.RootValue, error) {
// GetWorkingSet gets the current working set for the database.
// If there is no working set (most likely because the DB is in Detached Head mode, return an error.
// If a command needs to work while in Detached Head, that command should call sess.LookupDbState directly.
// TODO: Replace all uses of dbState.WorkingSet, including this, with a new interface.
// TODO: This is a temporary measure to make sure that new commands that call GetWorkingSet don't unexpectedly receive
// a null pointer. In the future, we should replace all uses of dbState.WorkingSet, including this, with a new interface
// where users avoid handling the WorkingSet directly.
func (db Database) GetWorkingSet(ctx *sql.Context) (*doltdb.WorkingSet, error) {
sess := dsess.DSessFromSess(ctx.Session)
dbState, ok, err := sess.LookupDbState(ctx, db.Name())