diff options
| author | tv <tv@krebsco.de> | 2026-11-15 23:36:51 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-15 23:36:51 +0000 |
| commit | b606449e51b8233d214f14500e0e47cd42af5744 (patch) | |
| tree | 9beea1cba3fe800de4ba01cb80fed38b8b7240ab /src | |
| parent | defe7fe994ad5b73c8b0d5bef9a51cf9f58ec3b2 (diff) | |
remakes: a group named for the change it goes as
Under a strict policy a group of other writes goes as the last change
by history that touched its path, above or below it, but was named for
the last that wrote at it or below: where the last replaced a map above
the path, the group went as one change and was judged as another's
user's. It is named for the change it goes as now.
Diffstat (limited to 'src')
| -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`). |
