{"record":{"id":"fc7d889c2ea69b15","repo":"nikivdev/code","slug":"not-a-git-repository-fc7d88","errorCode":null,"errorMessage":"not a git repository: {}","messagePattern":"not a git repository: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/repos.rs","lineNumber":1061,"sourceCode":"}\n\nfn repo_home_branch_status(\n    repo_root: &Path,\n    requested_home_branch: &str,\n) -> Result<HomeBranchRepoStatus> {\n    repo_home_branch_status_with_options(repo_root, requested_home_branch, true)\n}\n\nfn repo_home_branch_status_with_options(\n    repo_root: &Path,\n    requested_home_branch: &str,\n    include_private_mirror_status: bool,\n) -> Result<HomeBranchRepoStatus> {\n    let repo_root = repo_root\n        .canonicalize()\n        .unwrap_or_else(|_| repo_root.to_path_buf());\n    if !repo_root.join(\".git\").exists() {\n        bail!(\"not a git repository: {}\", repo_root.display());\n    }\n\n    let current_branch = git_capture_in(&repo_root, &[\"branch\", \"--show-current\"])\n        .unwrap_or_else(|_| \"HEAD\".to_string());\n    let configured_home_branch = config::configured_home_branch_for_repo(&repo_root);\n    let home_branch = configured_home_branch\n        .clone()\n        .unwrap_or_else(|| requested_home_branch.to_string());\n    let configured_public_remote = config::configured_public_remote_for_repo(&repo_root);\n    let origin_url = git_config_get(&repo_root, \"remote.origin.url\");\n    let upstream_url = git_config_get(&repo_root, \"remote.upstream.url\");\n    let fork_remote_url = git_config_get(&repo_root, \"remote.fork.url\");\n    let public_remote = resolve_public_remote_name(\n        configured_public_remote.as_deref(),\n        origin_url.as_deref(),\n        upstream_url.as_deref(),\n    );\n    let public_default_branch = public_remote","sourceCodeStart":1043,"sourceCodeEnd":1079,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/repos.rs#L1043-L1079","documentation":"home_branch_repo_status (gathering per-repo home-branch status) canonicalizes repo_root and verifies a `.git` entry exists; if not, it bails with this message including the path. The function only works on actual git repositories.","triggerScenarios":"Calling the status function on a directory lacking `.git` (plain folder, deleted repo, or a bare/worktree layout where `.git` is absent from the passed root).","commonSituations":"A configured repo path that was deleted or renamed; passing a subdirectory or parent of the repo instead of its root; repos converted to worktrees with the metadata elsewhere.","solutions":["Point the operation at the actual repository root containing `.git`.","Re-clone the repository if it was deleted.","Verify path configuration for that repo entry (typos, stale paths)."],"exampleFix":"// before\nstatus_for(Path::new(\"~/projects\"))  // parent dir, no .git\n// after\nstatus_for(Path::new(\"~/projects/myrepo\"))","handlingStrategy":"validation","validationCode":"fn is_repo_root(dir: &std::path::Path) -> bool {\n    dir.join(\".git\").exists()\n}\n// call the status API only if is_repo_root(&repo_root)","typeGuard":null,"tryCatchPattern":"match home_branch_repo_status(&repo_root, ... ) {\n    Err(e) if e.to_string().contains(\"not a git repository\") => {\n        eprintln!(\"{} is not a repo; skipping\", repo_root.display());\n    }\n    r => r?,\n}","preventionTips":["Verify configured repo paths point at directories containing `.git`.","Re-check paths after moving, renaming, or deleting repositories.","Pass the repo root, not a parent or subdirectory.","Handle worktrees/bare clones separately since `.git` may be absent at the passed root."],"tags":["git","path","validation"],"backgroundTag":"not-a-git-repository","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}