Check need_commit on purge_deleted_files.

This commit is contained in:
voussoir 2021-06-03 19:08:31 -07:00
parent b35cc8196f
commit f6cb496db4
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -303,9 +303,15 @@ def purge_deleted_files_argparse(args):
else:
photos = search_in_cwd(yield_photos=True, yield_albums=False)
need_commit = False
for deleted in photodb.purge_deleted_files(photos):
need_commit = True
print(deleted)
if not need_commit:
return
if args.autoyes or interactive.getpermission('Commit?'):
photodb.commit()
@ -320,9 +326,15 @@ def purge_empty_albums_argparse(args):
else:
albums = photodb.get_albums_within_directory(pathclass.cwd())
need_commit = False
for deleted in photodb.purge_empty_albums(albums):
need_commit = True
print(deleted)
if not need_commit:
return
if args.autoyes or interactive.getpermission('Commit?'):
photodb.commit()