diff options
| -rw-r--r-- | src/remake/delta.rs | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/remake/delta.rs b/src/remake/delta.rs index caa0b79..327249b 100644 --- a/src/remake/delta.rs +++ b/src/remake/delta.rs @@ -137,9 +137,10 @@ pub(crate) fn replay_newest( .iter() .map(|path| { let at = newest(&written, path).map_or(0, |(at, _)| at); - // Under a strict policy, whose the last write is by history, as it goes. + // Under a strict policy, the user of the change it goes as: the last by + // history that touched it (`last_written`). let user = if strict { - last_writer(&written, path) + last_written(&written, path).and_then(|made| written[made].1.clone()) } else { writer(&written, path) }; @@ -672,16 +673,6 @@ fn writer(changes: &[Touched], path: &[String]) -> Option<String> { .and_then(|(_, user)| user) } -/// The user of the last of `changes` (`touched`, in their order) that wrote at `path` or -/// below it. -fn last_writer(changes: &[Touched], path: &[String]) -> Option<String> { - changes - .iter() - .rev() - .find(|(_, _, paths)| paths.iter().any(|other| other.starts_with(path))) - .and_then(|(_, user, _)| user.clone()) -} - /// `paths`, each a map that writes for more than one user changed below split into its /// entries (in `src` or `dst`), until each part is one user's: a replayed change names /// one user, and rules by path judge it by that user (`access::rules`). |
