Skip to content

fix: Restore backed up repository state on import - #1410

Open
Phoenix1808 wants to merge 1 commit into
Droid-ify:mainfrom
Phoenix1808:fix/import-repo-enabled-state
Open

fix: Restore backed up repository state on import#1410
Phoenix1808 wants to merge 1 commit into
Droid-ify:mainfrom
Phoenix1808:fix/import-repo-enabled-state

Conversation

@Phoenix1808

@Phoenix1808 Phoenix1808 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Closes #1322

Problem

importRepos filtered out every imported repository whose address already
existed, so only genuinely new repositories were written. Preloaded
repositories are always present on a fresh install, so their backed up
"enabled": true was never read — the repository stayed disabled after
import. Deleting a repository before importing worked around it, since the
address was then absent and the full record got inserted.

Change

Match imported repositories against existing ones by address:

  • not present -> insert as before
  • present, enabled state differs -> restore it on the existing row
  • present, already correct -> left untouched

current.enable(...) is used rather than the imported object so the
existing row id is kept (exported repositories carry id = -1, which would
make put insert a duplicate) and so the sync cursor is reset — otherwise
the repository would be enabled but never re-indexed. This mirrors what
SyncService.setEnabled already does.

Repositories whose state already matches are skipped deliberately, to avoid
clearing every enabled repository's ETag and forcing a full re-sync on
every import.

Importing repositories skipped every address that already existed, so
the backed up enabled state of preloaded repositories was never applied.
Match imported repositories against existing ones by address and restore
the enabled state, keeping the existing row instead of skipping it.

Closes Droid-ify#1322
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Backed up enabled repositories remain disabled on import when they already exist

1 participant