summaryrefslogtreecommitdiffstats
path: root/src/watch/mirror.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
commit4304b0f336ddba7b4ec6780795059ff2066d105b (patch)
tree10edea744a1c2bf3fc363b4dc7f64abac8b1a0d3 /src/watch/mirror.rs
parente757979f1a2afdbe7146066345bb9acd19d3b151 (diff)
downloadaur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.tar.gz
aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.zip
comments: keep only what the code cannot show
Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound.
Diffstat (limited to 'src/watch/mirror.rs')
-rw-r--r--src/watch/mirror.rs18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/watch/mirror.rs b/src/watch/mirror.rs
index b6f9c47..89c175d 100644
--- a/src/watch/mirror.rs
+++ b/src/watch/mirror.rs
@@ -6,21 +6,14 @@ use crate::db::{self, Db};
use crate::error::{Error, Result};
use crate::git;
-/// Result of a cheap poll. `Unchanged` means we did **not** fetch — the poll is
-/// `git ls-remote`, one request per pkgbase (§5.1).
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Sync {
- /// Remote is gone (deleted from AUR).
Gone,
- /// `ls-remote` matched the local tip; no fetch performed.
Unchanged { head: String },
- /// The tip moved; we fetched and now have `head`.
Fetched { head: String, previous: Option<String> },
- /// We had no local mirror yet.
Cloned { head: String },
}
-/// Ensure a mirror exists and is polled. Updates `pkgbase.aur_head`.
pub fn sync_mirror(cfg: &Config, db: &Db, name: &str, url: &str) -> Result<Sync> {
let mirror = cfg.mirror_path(name);
let known_head = db::get_pkgbase(db, name)?.and_then(|p| p.aur_head.clone());
@@ -52,15 +45,9 @@ fn record(db: &Db, name: &str, head: &str, mirror: &Path) -> Result<()> {
db::set_aur_head(&db.writer, pb.id, head, &mirror.display().to_string())
}
-/// A materialized snapshot tree: blob ids for hashing, text bodies for parsing
-/// and diffing.
#[derive(Debug, Clone)]
pub struct Tree {
- /// `(path, git blob id)` for every file in the tree — the input to
- /// `recipe_hash`, which covers shipped patches too (§3).
pub blobs: Vec<(String, String)>,
- /// Text bodies, keyed by path. Binary files are omitted here but still
- /// counted in `blobs`.
pub files: BTreeMap<String, String>,
}
@@ -79,10 +66,7 @@ impl Tree {
}
}
-/// Read a commit's tree out of the mirror without touching the network.
pub fn read_tree(mirror: &Path, commit: &str) -> Result<Tree> {
- // §16 mirror divergence: if a pin we are asked to read has vanished, that is
- // a hard failure, not a silent re-pin.
if !git::has_commit(mirror, commit) {
return Err(Error::fail_closed(format!(
"commit {commit} is missing from the local mirror; history was rewritten"
@@ -104,8 +88,6 @@ fn looks_textual(b: &[u8]) -> bool {
!b[..b.len().min(512)].contains(&0)
}
-/// Raw bytes of one file at a commit — used to hash sources shipped in the AUR
-/// repo (§5.3 "local file shipped in the AUR repo").
pub fn read_file(mirror: &Path, commit: &str, path: &str) -> Result<Vec<u8>> {
git::read_blob(mirror, commit, path)
}