diff options
| author | aur-build <aur-build@localhost> | 2026-11-19 17:09:59 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-19 17:09:59 +0000 |
| commit | e757979f1a2afdbe7146066345bb9acd19d3b151 (patch) | |
| tree | 30d5f5fbccd25ea7bf01c5202684af463b74e7d3 /src/git.rs | |
| parent | 94c318f13264bb3c00a9f3057ba2e1aafb57c9e4 (diff) | |
| download | aur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.tar.gz aur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.zip | |
comments: say why, not what
Every module-level `//!` header is gone, and the comments that remained
either re-explained the line below them or had grown into paragraphs.
Density went from one comment line per 6.7 lines of code to one per 10.
827 insertions against 2194 deletions across 86 files.
What survived: the invariants (I1-I12), the design cross-references into
DESIGN.md, and the notes recording a bug that was found and fixed — those
are the comments that carry weight, because they answer a question the
code cannot answer about itself. What did not: restating a function
signature in prose, and narration of the statement underneath.
Diffstat (limited to 'src/git.rs')
| -rw-r--r-- | src/git.rs | 24 |
1 files changed, 8 insertions, 16 deletions
@@ -1,9 +1,3 @@ -//! Shelling out to `git` (DESIGN.md §4: "shell out to git ... avoids libgit2 -//! build pain"). -//! -//! Every git operation the system performs goes through here so the subprocess -//! surface is auditable in one place. - use std::path::Path; use std::process::{Command, Output}; @@ -40,8 +34,8 @@ pub fn git_ok(cwd: Option<&Path>, args: &[&str]) -> bool { git(cwd, args).is_ok() } -/// `git ls-remote <url> HEAD` — the cheap poll (§5.1). Returns the remote HEAD -/// SHA, or `None` when the remote is gone (deletion / orphan handling). +/// `git ls-remote <url> HEAD` — the cheap poll (§5.1). `None` when the remote is +/// gone. pub fn ls_remote_head(url: &str) -> Result<Option<String>> { match git(None, &["ls-remote", url, "HEAD"]) { Ok(out) => { @@ -91,10 +85,9 @@ fn is_missing_remote(e: &Error) -> bool { || s.contains("404") } -/// Clone an AUR mirror. `--mirror` so that `git fetch` actually moves our refs -/// (a plain clone would leave HEAD on the original commit), and **never** -/// `--filter=blob:none`: a partial clone can lazily drop blobs and we must be -/// able to materialize any historical commit forever (§5.1). +/// Clone an AUR mirror. `--mirror` so that `git fetch` actually moves our refs, +/// and **never** `--filter=blob:none`: a partial clone can lazily drop blobs and +/// we must be able to materialize any historical commit forever (§5.1). pub fn clone(url: &str, dest: &Path) -> Result<()> { if dest.exists() { return Ok(()); @@ -132,8 +125,8 @@ pub fn head(mirror: &Path) -> Result<String> { Ok(git(Some(mirror), &["rev-parse", "HEAD"])?.trim().to_string()) } -/// True if `commit` exists in the local mirror. Guards against a force-pushed -/// AUR history making a pin vanish (§16 mirror divergence). +/// True if `commit` exists in the local mirror. Guards against a force-pushed AUR +/// history making a pin vanish (§16 mirror divergence). pub fn has_commit(mirror: &Path, commit: &str) -> bool { git_ok(Some(mirror), &["cat-file", "-e", &format!("{commit}^{{commit}}")]) } @@ -192,8 +185,7 @@ pub fn materialize(mirror: &Path, commit: &str, dest: &Path) -> Result<()> { Ok(()) } -/// `git log --oneline range` — review context (§5.1) and the upstream delta -/// panel (§6). +/// `git log --oneline range` — review context (§5.1) and the upstream delta panel. pub fn log_oneline(mirror: &Path, range: &str) -> Result<Vec<String>> { let out = git(Some(mirror), &["log", "--oneline", range])?; Ok(out.lines().map(|l| l.to_string()).collect()) |
