aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/populate/src/populate.rs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/populate/src/populate.rs')
-rw-r--r--pkgs/populate/src/populate.rs31
1 files changed, 20 insertions, 11 deletions
diff --git a/pkgs/populate/src/populate.rs b/pkgs/populate/src/populate.rs
index 884ecd9..f8d5c0c 100644
--- a/pkgs/populate/src/populate.rs
+++ b/pkgs/populate/src/populate.rs
@@ -211,14 +211,16 @@ impl Delivery<'_> {
}
/// Transfers source_path, prepared on the deploying machine, to the
- /// target path, with rsync's default configuration.
+ /// target path, with rsync's default configuration, unless the probe
+ /// listed the target path, and it has what rsync would transfer.
fn transfer(&self, source_path: &Path) -> Result<Outcome> {
- let changed = rsync::transfer(
- self.context,
- &Config::default(),
- &source_path.to_string_lossy(),
- self.path,
- )?;
+ let config = Config::default();
+ let listing = self.target.and_then(|target| target.listing.as_ref());
+ let prepared = rsync::prepare(&config, &source_path.to_string_lossy(), listing.is_some())?;
+ if prepared.listing.is_some() && prepared.listing.as_ref() == listing {
+ return Ok(Outcome::changed(false));
+ }
+ let changed = rsync::transfer_prepared(self.context, &config, &prepared, self.path)?;
Ok(Outcome::changed(!changed.is_empty()))
}
}
@@ -356,9 +358,10 @@ fn gathered(
/// What the probe looks for at a source's target path, see probe::probe:
/// the listing of a file source that's a directory, that rsync compares by
-/// size and time, not checksum, the symlink of a symlink source, and the
-/// work tree of a git source with a commit as ref. Not where the flakes
-/// step rewrites a lock file in place, which delivering brings back.
+/// size and time, not checksum, and of a passage source, the symlink of a
+/// symlink source, the .pass_info of a pass source, and the work tree of a
+/// git source with a commit as ref. Not where the flakes step rewrites a
+/// lock file in place, which delivering brings back.
fn probed(_name: &str, source: &Source) -> Option<&'static str> {
if in_place_lock(source).is_some() {
return None;
@@ -368,6 +371,8 @@ fn probed(_name: &str, source: &Source) -> Option<&'static str> {
.is_ok_and(|path| Path::new(path).is_dir() && !file_config(source, path).use_checksum)
.then_some("F"),
"symlink" => Some("L"),
+ "passage" => Some("F"),
+ "pass" => Some("I"),
"git" => (string(&source.settings, "ref").is_ok_and(probe::is_commit)
&& source.settings.get("fetchAlways").and_then(Value::as_bool) != Some(true))
.then_some("G"),
@@ -585,7 +590,11 @@ impl Kind for Pass {
))?;
let info = info.trim_end_matches('\n');
if !info.is_empty() {
- let delivered = d.context.output(sh::PASS_INFO, &[d.path])?;
+ // What the probe read, else a command on the target.
+ let delivered = match d.target.and_then(|probed| probed.info.clone()) {
+ Some(delivered) => delivered,
+ None => d.context.output(sh::PASS_INFO, &[d.path])?,
+ };
if delivered.trim_end_matches('\n') == info {
return Ok(Outcome::changed(false));
}
[cgit] Unable to lock slot /tmp/cgit/1b300000.lock: Permission denied (13)