diff --git a/src/doltlite_config.c b/src/doltlite_config.c index 5880d8eaaa..5b3b4507e2 100644 --- a/src/doltlite_config.c +++ b/src/doltlite_config.c @@ -220,7 +220,14 @@ int doltliteMaybeSeedRepo(sqlite3 *db){ "Initialize data repository", NULL, NULL, 0, 0, &seedHash); if( rc!=SQLITE_OK ) return rc; - return doltliteAdvanceBranch(db, &seedHash, &emptyCatalog, 0); + /* Tables created before the seed live only in the session; the working + ** set must carry them, not the seed's empty catalog. */ + { + ProllyHash liveCatalog; + rc = doltliteFlushCatalogToHash(db, &liveCatalog); + if( rc!=SQLITE_OK ) return rc; + return doltliteAdvanceBranch(db, &seedHash, &emptyCatalog, &liveCatalog); + } } int doltliteConfigRegister(sqlite3 *db){ diff --git a/src/doltlite_core.c b/src/doltlite_core.c index 2353f183ed..a30da2e254 100644 --- a/src/doltlite_core.c +++ b/src/doltlite_core.c @@ -722,7 +722,13 @@ static int doltliteAdvanceBranchWithState( } } - rc = doltlitePersistWorkingSetWithHash(db, pWorkingCatHash); + /* A null working catalog used to flush the live session here, but the + ** head confirm can have reloaded that session from a peer's freshly + ** written working set: the persist then binds the peer's content to the + ** new head and the staleness gate waves it through. Advancing with no + ** explicit working catalog means the working set IS the new catalog. */ + rc = doltlitePersistWorkingSetWithHash( + db, pWorkingCatHash ? pWorkingCatHash : pCatalogHash); if( rc!=SQLITE_OK ){ return doltliteRestoreTxnStateOnFailure(db, pSaved, rc); }