{"record":{"id":"913ac58ed4b27683","repo":"GitoxideLabs/gitoxide","slug":"repository-at-must-have-a-worktree-checkout","errorCode":null,"errorMessage":"repository at {:?} must have a worktree checkout","messagePattern":"repository at (.+?) must have a worktree checkout","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/repository/attributes/validate_baseline.rs","lineNumber":124,"sourceCode":"                    let mut lines = stdout.lines().map_while(Result::ok).peekable();\n                    while let Some(baseline) = parse_attributes(&mut lines) {\n                        if tx_base.send(baseline).is_err() {\n                            child.kill().ok();\n                            break;\n                        }\n                    }\n\n                    Ok(())\n                }\n            });\n            tx\n        };\n        let work_dir = ignore\n            .then(|| {\n                #[expect(clippy::unnecessary_debug_formatting)]\n                repo.workdir()\n                    .map(ToOwned::to_owned)\n                    .ok_or_else(|| anyhow!(\"repository at {:?} must have a worktree checkout\", repo.path()))\n            })\n            .transpose()?;\n        let feed_excludes = ignore.then(|| {\n            let (tx, rx) = std::sync::mpsc::sync_channel::<BString>(100);\n            std::thread::spawn({\n                let path = work_dir.expect(\"present if we are here\");\n                let tx_base = tx_base.clone();\n                let mut progress = progress.add_child(\"excludes\");\n                move || -> anyhow::Result<()> {\n                    let mut child =\n                        std::process::Command::from(gix::command::prepare(gix::path::env::exe_invocation()))\n                            .args([\"check-ignore\", \"--stdin\", \"-nv\", \"--no-index\"])\n                            .stdin(std::process::Stdio::piped())\n                            .stdout(std::process::Stdio::piped())\n                            .stderr(std::process::Stdio::null())\n                            .current_dir(path)\n                            .spawn()?;\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/repository/attributes/validate_baseline.rs#L106-L142","documentation":"Thrown by `validate_baseline` when computing an attribute/exclude baseline that requires reading ignore (`ignore=true`) rules from disk, but the repository has no working tree checkout. Ignore files live in the workdir, so with a bare repository the baseline cannot include ignore rules.","triggerScenarios":"Calling `gix repo attributes validate-baseline --ignore` (via `validate_baseline`) on a bare repository where `repo.workdir()` returns `None` while ignore handling was requested.","commonSituations":"Validating attributes on a server bare clone, or after `git clone --bare`, while still passing ignore-related flags that expect a checked-out worktree with `.gitignore` files.","solutions":["Run validation against a non-bare clone that has a worktree checkout","Omit the ignore option and validate only attribute (`.gitattributes`) rules, which can come from the index/refs","Create a worktree for the bare repo (`git worktree add`) and run against it"],"exampleFix":"// before (bare repo, ignore requested)\ngix repo attributes validate-baseline --ignore\n// after (non-bare clone)\ngix repo attributes validate-baseline --ignore","handlingStrategy":"validation","validationCode":"if ignore_requested && repo.workdir().is_none() {\n    return Err(\"ignore baseline requires a worktree checkout; clone non-bare\".into());\n}","typeGuard":"fn can_read_ignore_rules(repo: &gix::Repository) -> bool {\n    repo.workdir().is_some()\n}","tryCatchPattern":null,"preventionTips":["Skip ignore validation on bare clones or add a worktree first (`git worktree add`)","Document in CI scripts that attribute baseline validation needs a full checkout"],"tags":["attributes","worktree","bare-repository","ignore","gitoxide"],"backgroundTag":"unsupported-operation","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}