Skip to content

Commit

Permalink
disable removing files from db when they don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jhidding committed Sep 30, 2024
1 parent 7d98c08 commit 57f3eae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions entangled/filedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,17 @@ def initialize() -> FileDB:
db = FileDB.read()
undead = list(filter(lambda p: not p.exists(), db.files))
for path in undead:
logging.warning(
"File `%s` in DB doesn't exist. Removing entry from DB.", path
)
del db[path]
if len(undead) > 0:
db.write()
if path in db.managed:
logging.warning(
"File `%s` in DB seems not to exist, but this file is managed.\n"
"This may happen every now and then with certain editors that "
"delete a file before writing.", path
)
else:
logging.warning(
"File `%s` is in database but doesn't seem to exist.\n"
"Run `entangled tangle -r` to recreate the database.", path
)
return db

FileDB.path().parent.mkdir(parents=True, exist_ok=True)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "entangled-cli"
version = "2.1.8"
version = "2.1.9"
description = "Literate Programming toolbox"
repository = "https://github.com/entangled/entangled.py"
homepage = "https://entangled.github.io/"
Expand Down

0 comments on commit 57f3eae

Please sign in to comment.