fix: list command only shows git repos, not org subdirs
Skip non-git directories inside org folders so flat layout dirs like claw-store/target or claw-store/.cargo don't appear as fake repos. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a9c12173fe
commit
8b4d0088ca
+14
-19
@@ -185,16 +185,26 @@ fn cmd_list(cfg: &Config, manifest: &Manifest) -> Result<()> {
|
|||||||
|
|
||||||
let mut rows: Vec<(String, bool, String)> = Vec::new();
|
let mut rows: Vec<(String, bool, String)> = Vec::new();
|
||||||
|
|
||||||
// Walk org/repo structure
|
if let Ok(top_entries) = std::fs::read_dir(base) {
|
||||||
if let Ok(orgs) = std::fs::read_dir(base) {
|
for org_entry in top_entries.flatten() {
|
||||||
for org_entry in orgs.flatten() {
|
|
||||||
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();
|
||||||
|
|
||||||
|
if org_path.join(".git").exists() {
|
||||||
|
// Top-level git repo (flat layout)
|
||||||
|
let active = manifest.get(&org);
|
||||||
|
let last = active
|
||||||
|
.and_then(|p| p.last_active)
|
||||||
|
.map(|t| t.format("%Y-%m-%d %H:%M").to_string())
|
||||||
|
.unwrap_or_else(|| "—".into());
|
||||||
|
rows.push((org, active.is_some(), last));
|
||||||
|
} else {
|
||||||
|
// Org directory — scan for repos inside it
|
||||||
if let Ok(repos) = std::fs::read_dir(&org_path) {
|
if let Ok(repos) = std::fs::read_dir(&org_path) {
|
||||||
for repo_entry in repos.flatten() {
|
for repo_entry in repos.flatten() {
|
||||||
let repo_path = repo_entry.path();
|
let repo_path = repo_entry.path();
|
||||||
if !repo_path.is_dir() { 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();
|
||||||
let key = format!("{}/{}", org, repo);
|
let key = format!("{}/{}", org, repo);
|
||||||
let active = manifest.get(&key);
|
let active = manifest.get(&key);
|
||||||
@@ -207,21 +217,6 @@ fn cmd_list(cfg: &Config, manifest: &Manifest) -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also include top-level repos (legacy flat layout)
|
|
||||||
if let Ok(entries) = std::fs::read_dir(base) {
|
|
||||||
for entry in entries.flatten() {
|
|
||||||
let p = entry.path();
|
|
||||||
if p.is_dir() && p.join(".git").exists() {
|
|
||||||
let name = entry.file_name().to_string_lossy().to_string();
|
|
||||||
let active = manifest.get(&name);
|
|
||||||
let last = active
|
|
||||||
.and_then(|p| p.last_active)
|
|
||||||
.map(|t| t.format("%Y-%m-%d %H:%M").to_string())
|
|
||||||
.unwrap_or_else(|| "—".into());
|
|
||||||
rows.push((name, active.is_some(), last));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rows.sort_by(|a, b| a.0.cmp(&b.0));
|
rows.sort_by(|a, b| a.0.cmp(&b.0));
|
||||||
|
|||||||
Reference in New Issue
Block a user