From 199958c1c5a34eb71896afa94788a2c2688783e2 Mon Sep 17 00:00:00 2001 From: Kris Cherven Date: Tue, 25 Mar 2025 18:10:20 -0400 Subject: [PATCH] Fix reparenting message with tags --- rslib/src/tags/reparent.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rslib/src/tags/reparent.rs b/rslib/src/tags/reparent.rs index 5d643379b..bcb9b5884 100644 --- a/rslib/src/tags/reparent.rs +++ b/rslib/src/tags/reparent.rs @@ -40,14 +40,23 @@ impl Collection { ) -> Result { let usn = self.usn()?; let mut matcher = TagMatcher::new(&join_tags(tags_to_reparent))?; + let old_to_new_names = old_to_new_names(tags_to_reparent, new_parent); if old_to_new_names.is_empty() { return Ok(0); } + let matched_notes = self .storage .get_note_tags_by_predicate(|tags| matcher.is_match(tags))?; - let match_count = matched_notes.len(); + + let mut match_count = 0; + for name in old_to_new_names.keys() { + if &UniCase::new(old_to_new_names.get(name).unwrap()) != name { + match_count += 1; + } + } + if match_count == 0 { // no matches; exit early so we don't clobber the empty tag entries return Ok(0);