pr: a69fa92c-0488-4685-afca-657f97aa50d5 applied: false verdict: fail resolved: [] created: 2026-09-10T06:42:27.385102176Z
conflict: src/build.rs patch: 869721576cbe61ad676382786c41b76e7d7597b6
file: src/build.rs
base master:src/build.rs:
<too large on base>
head m6/clone-origin:src/build.rs:
<too large on head>
patch:
diff --git a/src/build.rs b/src/build.rs
index 5083fa7..db835bb 100644
--- a/src/build.rs
+++ b/src/build.rs
@@ -33,6 +33,11 @@ pub struct BuildOptions {
pub branch_flag: Option<String>,
/// --clone-url flag (else git origin remote, else none).
pub clone_url_flag: Option<String>,
- ///
--public-originflag (else$HU13_PUBLIC_ORIGIN, else unset). - /// Base URL of this server, e.g.
http://host:39313. When set, the - /// clone block advertises
git clone <origin>/repo.bundle. - /// Empty/whitespace falls through to unset.
- pub public_origin_flag: Option<String>,
///
--repo-nameflag (else$HU13_REPO_NAME, else repo dir name). ///--titleis accepted as a deprecated alias for the same field. /// Empty/whitespace always falls back (the header is never blank). @@ -146,6 +151,32 @@ pub fn resolve_clone_url(repo: &Path, flag: Option<&str>) -> Option<String> { } }
+/// Resolve the public origin base URL (m6, f0rge issue #32).
+///
+/// Precedence: --public-origin flag > $HU13_PUBLIC_ORIGIN > unset
+/// (None). Flag and env values are trimmed; empty values fall through
+/// to unset. A single trailing / run is stripped so
+/// <origin>/repo.bundle never doubles the slash.
+#[must_use]
+pub fn resolve_public_origin(flag: Option<&str>) -> Option<String> {
- if let Some(f) = flag.map(str::trim).filter(|s| !s.is_empty()) {
-
let n = f.trim_end_matches('/'); -
if !n.is_empty() { -
return Some(n.to_string()); -
} - }
- if let Ok(env) = std::env::var("HU13_PUBLIC_ORIGIN") {
-
let t = env.trim(); -
if !t.is_empty() { -
let n = t.trim_end_matches('/'); -
if !n.is_empty() { -
return Some(n.to_string()); -
} -
} - }
- None +}
/// README lookup chain (f0rge convention): repo-root README.md >
/// readme.md > README, else .forge/wiki/README.md >
/// .forge/wiki/readme.md, else none.
@@ -261,13 +292,20 @@ pub fn file_hash(path: &Path) -> Option<String> {
}
/// Prominent Clone & download section for the code tab (m6, f0rge
-/// issue #20): stacked no-JS sections with selectable <pre> commands —
-/// git clone <url> first when a clone URL is configured, otherwise
-/// bundle-first — plus the bundle/tarball links with sizes and shas.
+/// issues #20 + #32): stacked no-JS sections with selectable <pre>
+/// commands. When a public origin is configured the primary command is
+/// git clone <origin>/repo.bundle (exact snapshot note + tarball
+/// secondary, origin remote demoted to "mirror source"); otherwise
+/// bundle-first as before (git clone <url> first when a clone URL is
+/// configured, else local bundle) plus the bundle/tarball links with
+/// sizes and shas.
#[must_use]
+#[allow(clippy::too_many_arguments)]
pub fn clone_block(
clone_url: Option<&str>,
- public_origin: Option<&str>, branch: &str,
- short_sha: &str,
bundle_size: u64,
bundle_sha: Option<&str>,
tarball_size: u64,
@@ -299,6 +337,32 @@ pub fn clone_block(
"<section class="clone-block" aria-label="Clone and download">\n
<h2>Clone & download</h2>\n", ); - if let Some(origin) = public_origin.map(str::trim).filter(|s| !s.is_empty()) {
-
let base = origin.trim_end_matches('/'); -
let bundle_url = format!("{base}/repo.bundle"); -
let tarball_url = format!("{base}/repo.tar.gz"); -
out.push_str("<h3>Clone with git</h3>\n"); -
out.push_str(&format!( -
"<pre class=\"clone-cmd\"><code>git clone {}</code></pre>\n\ -
<p>exact snapshot of <code>{}</code> @ <code>{}</code>.</p>\n", -
esc(&bundle_url), -
esc(branch), -
esc(short_sha) -
)); -
out.push_str("<h3>Download the tarball</h3>\n"); -
out.push_str(&format!( -
"<pre class=\"clone-cmd\"><code>curl -O {}</code></pre>\n<p>{tarball_link
...truncated