save initial empty branch after creating codebase schema · JavaDerek/unison@2851b70 · GitHub
Skip to content

Commit 2851b70

Browse files
committed
save initial empty branch after creating codebase schema
1 parent 5635edd commit 2851b70

4 files changed

Lines changed: 57 additions & 3 deletions

File tree

‎codebase2/codebase/U/Codebase/Branch.hs‎

Lines changed: 1 addition & 1 deletion

‎parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ createCodebaseOrError' path = do
148148
Control.Exception.bracket
149149
(unsafeGetConnection path)
150150
Sqlite.close
151-
(runReaderT Q.createSchema)
151+
(runReaderT do
152+
Q.createSchema
153+
runExceptT (void . Ops.saveRootBranch $ Cv.causalbranch1to2 Branch.empty) >>= \case
154+
Left e -> error $ show e
155+
Right () -> pure ()
156+
)
157+
152158
fmap (Either.mapLeft CreateCodebaseMissingSchema) (sqliteCodebase path)
153159

154160
-- get the codebase in dir

‎questions.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ next steps:
2222
- [ ] to get updates notifications, we could watch the sqlite file itself for changes, and check
2323
png
2424
- [x] consider using `causal` table to detect if a causal exists, instead of causal_parent?
25+
- [x] no root found, for new codebase?
26+
.> ls
27+
28+
❗️
29+
30+
I couldn't find the codebase root!
31+
2532
- [ ] set-root-branch being called inappropriately on `pull`
2633

27-
- [ ] weird error message?
34+
- [ ] weird error message when codebase doesn't exist
2835
C:\Users\arya\unison>stack exec unison
2936
unison.EXE: SQLite3 returned ErrorCan'tOpen while attempting to perform open "C:\\Users\\arya\\.unison\\v2\\unison.sqlite3": unable to open database file
3037

Lines changed: 41 additions & 0 deletions

0 commit comments

Comments
 (0)