fix: skip *.git symlinks in project list scanner

Gitea creates a repo.git → repo symlink alongside every real checkout
in /slab/projects. The directory walker resolved both, found .git inside
each (since the symlink points at the real dir), and emitted a duplicate
entry for every project — e.g. quantumclaw/clawhdf5 and
quantumclaw/clawhdf5.git both appeared in the dashboard.

Add ends_with(".git") guard at both the org and repo levels of
build_projects_list so symlinked aliases are always skipped.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
Omar Sobh
2026-06-30 10:56:54 +00:00
co-authored by Claude Sonnet 4.6
parent 1320d2df9e
commit f6ff04e9dc
+4
View File
@@ -416,6 +416,9 @@ fn build_projects_list(
let org_path = org_entry.path(); let org_path = org_entry.path();
if !org_path.is_dir() { continue; } if !org_path.is_dir() { continue; }
let org = org_entry.file_name().to_string_lossy().to_string(); let org = org_entry.file_name().to_string_lossy().to_string();
// Skip *.git symlinks — each real dir has a matching repo.git → repo
// symlink used by Gitea; resolving both would emit duplicate entries.
if org.ends_with(".git") { continue; }
if org_path.join(".git").exists() { if org_path.join(".git").exists() {
push(org, org_path); push(org, org_path);
@@ -424,6 +427,7 @@ fn build_projects_list(
let repo_path = repo_entry.path(); let repo_path = repo_entry.path();
if !repo_path.is_dir() || !repo_path.join(".git").exists() { continue; } if !repo_path.is_dir() || !repo_path.join(".git").exists() { continue; }
let repo = repo_entry.file_name().to_string_lossy().to_string(); let repo = repo_entry.file_name().to_string_lossy().to_string();
if repo.ends_with(".git") { continue; }
let key = format!("{}/{}", org, repo); let key = format!("{}/{}", org, repo);
push(key, repo_path); push(key, repo_path);
} }