aboutsummaryrefslogtreecommitdiffstats
path: root/src/document/store.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/document/store.rs')
-rw-r--r--src/document/store.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/document/store.rs b/src/document/store.rs
index 2e27b44..31c4824 100644
--- a/src/document/store.rs
+++ b/src/document/store.rs
@@ -93,8 +93,19 @@ pub(crate) fn changed_by(
hash: &automerge::ChangeHash,
lists: InLists,
) -> Option<Vec<Vec<String>>> {
- use automerge::legacy::{Key, ObjectId};
let change = doc.get_change_by_hash(hash)?.decode();
+ Some(changed_by_decoded(doc, hash, change, lists))
+}
+
+/// [`changed_by`] of a change already decoded (`change`, whose hash is `hash`), as from
+/// the bytes it came as: what the document rebuilding it would cost spared.
+pub(crate) fn changed_by_decoded(
+ doc: &Automerge,
+ hash: &automerge::ChangeHash,
+ change: automerge::ExpandedChange,
+ lists: InLists,
+) -> Vec<Vec<String>> {
+ use automerge::legacy::{Key, ObjectId};
let heads = [*hash];
// Each object's path as it was after the change, and whether that is a list's (as
// `InLists::Whole` names what is inside one).
@@ -127,7 +138,7 @@ pub(crate) fn changed_by(
}
paths.insert(path);
}
- Some(paths.into_iter().collect())
+ paths.into_iter().collect()
}
/// Whether one path is within the other (a change at either touches both).