Commit 897803d
Fix: Prevent reinitialization of existing ProllyTree stores (#100)
The init function in versioned_store.rs was creating a new store even when one already existed, potentially causing data loss. This fix adds a check for existing prolly config files before initialization.
Changes:
- Added check for prolly_config_tree_config and prolly_hash_mappings files in init()
- If either file exists, calls open() to load the existing store instead of creating a new one
- Added comprehensive test to verify the behavior
This ensures that repeatedly calling init on the same directory preserves existing data and doesn't create duplicate Initial commit entries.
Fixes the issue where init would overwrite an existing store configuration.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>1 parent ceb3cdf commit 897803d
1 file changed
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1181 | 1181 | | |
1182 | 1182 | | |
1183 | 1183 | | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
1184 | 1193 | | |
1185 | 1194 | | |
1186 | 1195 | | |
| |||
2673 | 2682 | | |
2674 | 2683 | | |
2675 | 2684 | | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
2676 | 2725 | | |
2677 | 2726 | | |
2678 | 2727 | | |
| |||
0 commit comments