Commit
Message
Changed Files (8)
-
modified CHANGELOG.md
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2be8676..3bedba3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,18 @@ +## [unreleased] + +### 🐛 Bug Fixes + +- Re-add aarch64 musl target + +### 📚 Documentation + +- Update mise plugin targets to musl ## [0.9.1] - 2026-06-20 ### 🐛 Bug Fixes - Restore default git UI prefix to repository +- Drop aarch64 target for site build (no cross-compiler on dev) ### ⚙️ Miscellaneous Tasks -
modified abbaye.toml
diff --git a/abbaye.toml b/abbaye.toml index 7c6eb47..dab9da3 100644 --- a/abbaye.toml +++ b/abbaye.toml @@ -142,6 +142,7 @@ category = "Binaries" name = "Pre-built binaries" comment = "Built for x86_64 and aarch64 Linux (musl)." type = "cargo" +use_cross = true # Target triples for cross-compilation (optional, default: [] = host target). targets = ["x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl"] -
modified src/git_browse.rs
diff --git a/src/git_browse.rs b/src/git_browse.rs index 8cbaece..2cdc0e1 100644 --- a/src/git_browse.rs +++ b/src/git_browse.rs @@ -31,6 +31,7 @@ struct TreeEntry { name: String, kind: TreeEntryKind, url: String, + raw_url: Option<String>, } // ── Entry point ──────────────────────────────────────────────────────────────── @@ -48,6 +49,7 @@ pub(crate) fn build_browse_pages( formats: &[OutputFormat], git_ui_path: &str, prefix_empty: bool, + ref_map: &[(&str, &str)], ) -> Result<()> { use syntect::highlighting::ThemeSet; use syntect::parsing::SyntaxSet; @@ -103,6 +105,18 @@ pub(crate) fn build_browse_pages( )?; } + // Create stable ref-based symlinks so browse/<ref>/foo points at the same + // content as browse/<hash>/foo. Ref names containing '/' are flattened + // to '-' to avoid directory conflicts with repo paths. + for (ref_name, commit_hash) in ref_map { + let target = browse_dir.join(ref_name); + if target.exists() { + std::fs::remove_file(&target).ok(); + std::fs::remove_dir(&target).ok(); + } + let _ = std::os::unix::fs::symlink(commit_hash, &target); + } + Ok(()) } @@ -154,6 +168,7 @@ fn walk_tree_dir( url: format!("{name}/index.html"), name: name.clone(), kind: TreeEntryKind::Tree, + raw_url: None, }); subdirs.push((name, oid)); } else { @@ -161,6 +176,7 @@ fn walk_tree_dir( url: format!("{name}.html"), name: name.clone(), kind: TreeEntryKind::Blob, + raw_url: Some(name.clone()), }); if !entry.mode.is_commit() { blobs.push((name, oid)); @@ -293,6 +309,11 @@ fn render_blob_page( let is_binary = data[..data.len().min(8192)].contains(&0u8); let too_large = data.len() > MAX_BLOB_BYTES; + // Write raw blob content so the file can be downloaded directly. + if !data.is_empty() { + std::fs::write(page_dir.join(filename), &data).into_diagnostic()?; + } + let text = String::from_utf8_lossy(&data); let content_plain: Option<String> = if is_binary || too_large || data.is_empty() { None @@ -357,6 +378,7 @@ fn render_blob_page( ctx.insert("size", &data.len()); ctx.insert("root_path", &root_path); ctx.insert("git_ui_path", git_ui_path); + ctx.insert("raw_url", filename); let content = tera .render(&tmpl_name, &ctx) -
modified src/git_ui.rs
diff --git a/src/git_ui.rs b/src/git_ui.rs index 525c9dd..18ed739 100644 --- a/src/git_ui.rs +++ b/src/git_ui.rs @@ -498,7 +498,27 @@ pub async fn build_git_repository_ui(config: &AbbayeConfig, git_cfg: &GitUiConfi let git_ui_path_browse = git_ui_path.clone(); let prefix_empty_browse = prefix_empty; + // Build a map of sanitized ref names → commit hash so that stable + // browse/<ref>/ paths can symlink to the hash-based directories. + let ref_map: Vec<(String, String)> = tags + .iter() + .chain(ref_branches.iter()) + .filter_map(|r| { + let hash = &r.hash; + if browse_revisions.iter().any(|(h, _)| h == hash) { + Some((r.short_name.replace('/', "-"), hash.clone())) + } else { + None + } + }) + .collect(); + tokio::task::spawn_blocking(move || { + // Convert to borrowed slices for the callee. + let ref_refs: Vec<(&str, &str)> = ref_map + .iter() + .map(|(n, h)| (n.as_str(), h.as_str())) + .collect(); crate::git_browse::build_browse_pages( &browse_revisions, &browse_dir, @@ -510,6 +530,7 @@ pub async fn build_git_repository_ui(config: &AbbayeConfig, git_cfg: &GitUiConfi &formats, &git_ui_path_browse, prefix_empty_browse, + &ref_refs, ) }) .await -
modified src/templates/git_blob.gmi.j2
diff --git a/src/templates/git_blob.gmi.j2 b/src/templates/git_blob.gmi.j2 index 12bc9db..ec65b78 100644 --- a/src/templates/git_blob.gmi.j2 +++ b/src/templates/git_blob.gmi.j2 @@ -7,8 +7,9 @@ {% endfor %} ## {{ filename }} +=> {{ raw_url }} Download {% if is_binary %} -=> {{ file_path }} Download (binary) +Binary file ({{ size }} bytes). {% elif too_large %} File too large ({{ size }} bytes) to display inline. {% elif content_plain %} -
modified src/templates/git_blob.html.j2
diff --git a/src/templates/git_blob.html.j2 b/src/templates/git_blob.html.j2 index d4a748f..1e9a3eb 100644 --- a/src/templates/git_blob.html.j2 +++ b/src/templates/git_blob.html.j2 @@ -18,12 +18,12 @@ {% endfor %} </nav> - <p class="tree-rev">at <a class="hash" href="{{ commit_url }}">{{ commit_hash_short }}</a></p> + <p class="tree-rev">at <a class="hash" href="{{ commit_url }}">{{ commit_hash_short }}</a> <a class="raw-link" href="{{ raw_url }}">Raw</a></p> {% if is_binary %} - <p class="blob-notice">Binary file ({{ size }} bytes)</p> + <p class="blob-notice">Binary file ({{ size }} bytes) — <a href="{{ raw_url }}">Download</a></p> {% elif too_large %} - <p class="blob-notice">File too large to display ({{ size }} bytes)</p> + <p class="blob-notice">File too large to display ({{ size }} bytes) — <a href="{{ raw_url }}">Download</a></p> {% elif content_html %} <div class="blob-content">{{ content_html | safe }}</div> {% else %} -
modified src/templates/git_tree.gmi.j2
diff --git a/src/templates/git_tree.gmi.j2 b/src/templates/git_tree.gmi.j2 index 821505a..82d7667 100644 --- a/src/templates/git_tree.gmi.j2 +++ b/src/templates/git_tree.gmi.j2 @@ -8,5 +8,6 @@ ## {{ dir_path | default(value="/") }} {% for entry in entries %} -=> {{ entry.url | replace(from=".html", to=".gmi") }} {{ entry.name }} +=> {{ entry.url | replace(from=".html", to=".gmi") }} {{ entry.name }}{% if entry.kind == "blob" %} +=> {{ entry.raw_url | default(value='') }} Download {{ entry.name }}{% endif %} {% endfor %} -
modified src/templates/git_tree.html.j2
diff --git a/src/templates/git_tree.html.j2 b/src/templates/git_tree.html.j2 index f194760..2563913 100644 --- a/src/templates/git_tree.html.j2 +++ b/src/templates/git_tree.html.j2 @@ -28,6 +28,7 @@ <a class="tree-entry-tree" href="{{ entry.url }}">{{ entry.name | escape }}/</a> {% else %} <a class="tree-entry-blob" href="{{ entry.url }}">{{ entry.name | escape }}</a> + <a class="raw-link" href="{{ entry.raw_url | default(value='') }}">Raw</a> {% endif %} </td> </tr>