/{cmd,internal}: maybe fix tool tip closed store bug
This commit is contained in:
parent
58dc2e1b8b
commit
73f2ab613b
2 changed files with 12 additions and 2 deletions
|
|
@ -393,8 +393,11 @@ var createCmd = &cobra.Command{
|
|||
_ = store.Close() // Best effort cleanup on error path
|
||||
}
|
||||
|
||||
// Replace store for remainder of create operation
|
||||
store = targetStore
|
||||
// Replace store for remainder of create operation.
|
||||
// Must use setStore to sync cmdCtx.Store — a bare `store = targetStore`
|
||||
// leaves cmdCtx.Store pointing at the closed original, which causes
|
||||
// "store is closed" in PostRun tip auto-commit (GH#tip-closed-bug).
|
||||
setStore(targetStore)
|
||||
}
|
||||
|
||||
// Check for conflicting flags
|
||||
|
|
|
|||
|
|
@ -53,6 +53,13 @@ type EmbeddedDoltStore struct {
|
|||
// errClosed is returned when a method is called after Close.
|
||||
var errClosed = errors.New("embeddeddolt: store is closed")
|
||||
|
||||
// IsClosed reports whether the store has been closed. Implements
|
||||
// storage.LifecycleManager so that callers (e.g., maybeAutoCommit) can
|
||||
// skip operations on a closed store without triggering errClosed.
|
||||
func (s *EmbeddedDoltStore) IsClosed() bool {
|
||||
return s.closed.Load()
|
||||
}
|
||||
|
||||
// Option configures optional behavior for New.
|
||||
type Option func(*options)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue