Skip to content

Commit ce3c306

Browse files
committed
removed "migration" support for cache
Just delete the old .db file form the .config, or just leave it
1 parent 5f03890 commit ce3c306

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,14 @@ Cache database location: `~/.local/share/gitfetch/cache.db`
273273

274274
This follows XDG Base Directory specification for application data.
275275

276+
### Upgrading from older versions
277+
278+
If you have an older version of gitfetch that stored cache in `~/.config/gitfetch/cache.db`, you can safely delete the old cache file:
279+
280+
```bash
281+
rm ~/.config/gitfetch/cache.db
282+
```
283+
276284
## Why GitHub CLI?
277285

278286
Using the GitHub CLI (gh) instead of direct API calls provides several benefits:

src/gitfetch/cache.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,6 @@ def __init__(self, cache_expiry_hours: int = 6):
2929
def _ensure_cache_dir(self) -> None:
3030
"""Ensure cache directory exists."""
3131
self.CACHE_DIR.mkdir(parents=True, exist_ok=True)
32-
self._migrate_old_cache()
33-
34-
def _migrate_old_cache(self) -> None:
35-
"""Migrate cache from old locations to new."""
36-
old_locations = [
37-
Path.home() / ".config" / "gitfetch",
38-
Path.home() / ".cache" / "gitfetch"
39-
]
40-
new_db_file = self.DB_FILE
41-
42-
for old_cache_dir in old_locations:
43-
old_db_file = old_cache_dir / "cache.db"
44-
if old_db_file.exists() and not new_db_file.exists():
45-
try:
46-
# Copy the old database to the new location
47-
import shutil
48-
new_db_file.parent.mkdir(parents=True, exist_ok=True)
49-
shutil.copy2(old_db_file, new_db_file)
50-
print(f"Cache migrated from {old_db_file} to "
51-
f"{new_db_file}")
52-
break # Only migrate from the first found location
53-
except Exception:
54-
# If migration fails, just continue
55-
pass
5632

5733
def _init_database(self) -> None:
5834
"""Initialize SQLite database with required tables."""

0 commit comments

Comments
 (0)