diff options
| author | tv <tv@krebsco.de> | 2026-12-01 00:26:36 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-12-01 00:26:36 +0000 |
| commit | 5df6e41e05b9449a964467bc11a9d7fce2d802ec (patch) | |
| tree | de72c779f03f7cb55ce083d527fc479245d0c8ef /pkgs/populate/src/rsync.rs | |
| parent | 85afc649ffeea7c92027f57e0a1bdec27d9bc8c9 (diff) | |
populate: skip symlink and git sources with nothing to do
Each command on a remote target costs about three round trips, so the
bench's 30 symlink and 20 git sources took about 4.5 of a no-op run's 7.2
s with 30 ms to the target, with one command each.
The command after taking the lock that lists file sources, now the probe
(probe.rs), also finds out what's at the target paths of symlink sources,
the symlink, if any, and of git sources with a commit as ref and without
fetchAlways: if git_problems finds nothing wrong with the work tree, which
keeps guarding every Git command, its HEAD, its origin's URL, and what git
status --ignored and git submodule status print. A symlink source whose
symlink points to the target already runs nothing. So does a git source
whose work tree has the commit checked out, the source's URL, nothing
modified, untracked, or ignored, and its submodules at their commits; the
flakes step takes it for checked, as after the git script. Not where the
flakes step rewrites a lock file in place.
The scenario symlink-git-skip checks that an unchanged symlink stays the
same file, which ln would replace, and that a symlink pointing elsewhere,
a modified file, an untracked one, and another commit make them deliver
again.
Diffstat (limited to 'pkgs/populate/src/rsync.rs')
| -rw-r--r-- | pkgs/populate/src/rsync.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/populate/src/rsync.rs b/pkgs/populate/src/rsync.rs index 011c021..3a28c23 100644 --- a/pkgs/populate/src/rsync.rs +++ b/pkgs/populate/src/rsync.rs @@ -454,7 +454,13 @@ fn canonical_listed(line: &str) -> Option<String> { /// size, modification time in seconds since the epoch, path relative to /// where find started, empty for that, and symlink target, or None, like /// canonical_listed. -fn canonical_found(mode: &str, size: &str, time: &str, path: &str, target: &str) -> Option<String> { +pub fn canonical_found( + mode: &str, + size: &str, + time: &str, + path: &str, + target: &str, +) -> Option<String> { let path = if path.is_empty() { "." } else { path }; if mode.len() != 10 || incomparable(path) || incomparable(target) { return None; @@ -535,7 +541,7 @@ pub fn found(output: &str) -> BTreeMap<String, Option<Listing>> { } /// The listing of source on the deploying machine, with find, as -/// sh::LISTINGS prints it for the target, or None. +/// sh::LISTINGS prints it, as the probe does for the target, or None. fn found_locally(source: &str) -> Option<Listing> { let output = run::output( Command::new(run::SH) |
