From eb34eacec87d716e952ab79fa8efb82ba72b3726 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Tue, 8 Jun 2021 16:43:25 -0700 Subject: [PATCH] Changed batch mode to update the repo state before exiting in the case of an error --- go/cmd/dolt/commands/sql.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/go/cmd/dolt/commands/sql.go b/go/cmd/dolt/commands/sql.go index 2fe51287fc..dfbedd3b25 100644 --- a/go/cmd/dolt/commands/sql.go +++ b/go/cmd/dolt/commands/sql.go @@ -394,6 +394,10 @@ func execBatch(sqlCtx *sql.Context, readOnly bool, mrEnv env.MultiRepoEnv, roots err = runBatchMode(sqlCtx, se, batchInput) if err != nil { + // If we encounter an error, flush what we have so far to disk before exiting + _ = flushBatchedEdits(sqlCtx, se) + _ = writeRoots(sqlCtx, se, mrEnv, roots) + return errhand.BuildDError("Error processing batch").Build() }