From 989845199bfa4139374c8e93f13feb590243dd45 Mon Sep 17 00:00:00 2001 From: wordofglass Date: Thu, 24 Aug 2017 13:07:20 +0200 Subject: [PATCH] edit: Correctly reset the old object, do not reload it from the tags Previously, if continuing to edit (i.e. invoking the $EDITOR) multiple times in one invocation of EditPlugin.edit_objects, the plugin would reload the old state from the file tags. The initial 'old state' is usually only loaded from the database, though. As a consequence, if database and tags were not in sync, the diffs from first and all subsequent edits could differ unexpectedly. --- beetsplug/edit.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/beetsplug/edit.py b/beetsplug/edit.py index 8feb28f27..eba2db659 100644 --- a/beetsplug/edit.py +++ b/beetsplug/edit.py @@ -302,9 +302,14 @@ class EditPlugin(plugins.BeetsPlugin): elif choice == u'c': # Cancel. return False elif choice == u'e': # Keep editing. - # Reset the temporary changes to the objects. + # Reset the temporary changes to the objects. I we have a + # deepcopy from above, use that, else reload from the + # database. + objs = [(old_obj or obj) + for old_obj, obj in zip(objs_old, objs)] for obj in objs: - obj.read() + if obj._db: + obj.load() continue # Remove the temporary file before returning.