fix(sync): initialize store after daemon disconnect (GH#984)
The sync command was closing the daemon connection without initializing the direct store, leaving store=nil. This caused errors in post-checkout hook when running bd sync --import-only. Fixed by using fallbackToDirectMode() which properly closes daemon and initializes the store. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -621,8 +621,10 @@ func (m *MemoryStorage) SearchIssues(ctx context.Context, query string, filter t
|
||||
}
|
||||
|
||||
// ID prefix filtering (for shell completion)
|
||||
if filter.IDPrefix != "" && !strings.HasPrefix(issue.ID, filter.IDPrefix) {
|
||||
continue
|
||||
if filter.IDPrefix != "" {
|
||||
if !strings.HasPrefix(issue.ID, filter.IDPrefix) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// Parent filtering (bd-yqhh): filter children by parent issue
|
||||
@@ -1661,8 +1663,8 @@ func (m *MemoryStorage) GetCustomStatuses(ctx context.Context) ([]string, error)
|
||||
return parseCustomStatuses(value), nil
|
||||
}
|
||||
|
||||
// parseCommaSeparated splits a comma-separated string into a slice of trimmed values.
|
||||
func parseCommaSeparated(value string) []string {
|
||||
// parseCustomStatuses splits a comma-separated string into a slice of trimmed status names.
|
||||
func parseCustomStatuses(value string) []string {
|
||||
if value == "" {
|
||||
return nil
|
||||
}
|
||||
@@ -1677,11 +1679,6 @@ func parseCommaSeparated(value string) []string {
|
||||
return result
|
||||
}
|
||||
|
||||
// Alias for backwards compatibility in tests
|
||||
func parseCustomStatuses(value string) []string {
|
||||
return parseCommaSeparated(value)
|
||||
}
|
||||
|
||||
// GetCustomTypes retrieves the list of custom issue types from config.
|
||||
func (m *MemoryStorage) GetCustomTypes(ctx context.Context) ([]string, error) {
|
||||
value, err := m.GetConfig(ctx, "types.custom")
|
||||
@@ -1691,7 +1688,7 @@ func (m *MemoryStorage) GetCustomTypes(ctx context.Context) ([]string, error) {
|
||||
if value == "" {
|
||||
return nil, nil
|
||||
}
|
||||
return parseCommaSeparated(value), nil
|
||||
return parseCustomStatuses(value), nil
|
||||
}
|
||||
|
||||
// Metadata
|
||||
|
||||
@@ -112,12 +112,26 @@ func (s *SQLiteStorage) GetCustomStatuses(ctx context.Context) ([]string, error)
|
||||
if value == "" {
|
||||
return nil, nil
|
||||
}
|
||||
return parseCommaSeparated(value), nil
|
||||
return parseCustomStatuses(value), nil
|
||||
}
|
||||
|
||||
// parseCommaSeparated splits a comma-separated string into a slice of trimmed values.
|
||||
// GetCustomTypes retrieves the list of custom issue types from config.
|
||||
// Custom types are stored as comma-separated values in the "types.custom" config key.
|
||||
// Returns an empty slice if no custom types are configured.
|
||||
func (s *SQLiteStorage) GetCustomTypes(ctx context.Context) ([]string, error) {
|
||||
value, err := s.GetConfig(ctx, CustomTypeConfigKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if value == "" {
|
||||
return nil, nil
|
||||
}
|
||||
return parseCommaSeparatedList(value), nil
|
||||
}
|
||||
|
||||
// parseCommaSeparatedList splits a comma-separated string into a slice of trimmed entries.
|
||||
// Empty entries are filtered out.
|
||||
func parseCommaSeparated(value string) []string {
|
||||
func parseCommaSeparatedList(value string) []string {
|
||||
if value == "" {
|
||||
return nil
|
||||
}
|
||||
@@ -132,16 +146,7 @@ func parseCommaSeparated(value string) []string {
|
||||
return result
|
||||
}
|
||||
|
||||
// GetCustomTypes retrieves the list of custom issue types from config.
|
||||
// Custom types are stored as comma-separated values in the "types.custom" config key.
|
||||
// Returns an empty slice if no custom types are configured.
|
||||
func (s *SQLiteStorage) GetCustomTypes(ctx context.Context) ([]string, error) {
|
||||
value, err := s.GetConfig(ctx, CustomTypeConfigKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if value == "" {
|
||||
return nil, nil
|
||||
}
|
||||
return parseCommaSeparated(value), nil
|
||||
// parseCustomStatuses is an alias for parseCommaSeparatedList for backward compatibility.
|
||||
func parseCustomStatuses(value string) []string {
|
||||
return parseCommaSeparatedList(value)
|
||||
}
|
||||
|
||||
@@ -976,7 +976,7 @@ func (t *sqliteTxStorage) GetCustomStatuses(ctx context.Context) ([]string, erro
|
||||
if value == "" {
|
||||
return nil, nil
|
||||
}
|
||||
return parseCommaSeparated(value), nil
|
||||
return parseCommaSeparatedList(value), nil
|
||||
}
|
||||
|
||||
// GetCustomTypes retrieves the list of custom issue types from config within the transaction.
|
||||
@@ -988,7 +988,7 @@ func (t *sqliteTxStorage) GetCustomTypes(ctx context.Context) ([]string, error)
|
||||
if value == "" {
|
||||
return nil, nil
|
||||
}
|
||||
return parseCommaSeparated(value), nil
|
||||
return parseCommaSeparatedList(value), nil
|
||||
}
|
||||
|
||||
// SetMetadata sets a metadata value within the transaction.
|
||||
|
||||
Reference in New Issue
Block a user