fix: resolve a repo's friendly web/CLI path even when it's stored on disk as `<name>.git`
commit
83a16a3fix: resolve a repo's friendly web/CLI path even when it's stored on disk as `<name>.git`
resolve_repo only matched a URL segment against the exact same-named
directory on disk. Repos pushed with a .git-suffixed remote URL (as
git.ents.cloud’s own git-ents mirror is) are stored as <name>.git`,
so every friendly path — the web UI’s /git-ents/… pages and the
CLI’s checks debug/checks runs — 404’d, and pages that did resolve
via the ugly /git-ents.git/… form leaked .git into the title and
links. Now the lookup falls back to the .git-suffixed name.
fix: fall back to a <name>.git directory when a repo’s disk name has no bare match
Assisted-by: Claude:claude-sonnet-5
Reviews
No reviews of this commit yet — record a verdict below.
Start a review
crates/git-ents-server/src/web/mod.rs
@@ -100,9 +100,22 @@
}
let relative: PathBuf = repo_segs.iter().collect();
let repo = data_dir.join(&relative);
- if !is_bare_repo(&repo) {
+ // Bare repos are stored on disk as `<name>.git`, matching what
+ // `git http-backend` expects, but the friendly web/CLI paths never
+ // include the suffix — so try it on the last segment before giving up.
+ let repo = if is_bare_repo(&repo) {
+ repo
+ } else if let Some((last, init)) = repo_segs.split_last() {
+ let mut with_suffix = data_dir.join(init.iter().collect::<PathBuf>());
+ with_suffix.push(format!("{last}.git"));
+ if is_bare_repo(&with_suffix) {
+ with_suffix
+ } else {
+ continue;
+ }
+ } else {
continue;
- }
+ };
let rel = repo_segs.join("/");
let rest = segments.get(depth..).unwrap_or_default();
return Some((repo, rel, rest));