Check need_commit on purge_deleted_files.

master
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
1 changed files with 12 additions and 0 deletions

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()