{"record":{"id":"0c1919f277748825","repo":"GitoxideLabs/gitoxide","slug":"an-editable-commit-is-not-connected-to-the-selecte","errorCode":null,"errorMessage":"an editable commit is not connected to the selected base","messagePattern":"an editable commit is not connected to the selected base","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/todo.rs","lineNumber":142,"sourceCode":"            break;\n        }\n        cursor = commit\n            .parents\n            .first()\n            .copied()\n            .filter(|parent| scope_set.contains(parent));\n    }\n    let apply_unchanged = base != onto || has_pending;\n\n    let mut children = HashMap::<ObjectId, Vec<ObjectId>>::new();\n    for commit in commits {\n        let parent = commit\n            .parents\n            .first()\n            .copied()\n            .context(\"an editable commit has no parent\")?;\n        if parent != base && !scope_set.contains(&parent) {\n            anyhow::bail!(\"an editable commit is not connected to the selected base\");\n        }\n        children.entry(parent).or_default().push(commit.id);\n    }\n    let mut sections = Vec::new();\n    for child in children.get(&base).into_iter().flatten().copied() {\n        let mut section = Section {\n            parent: onto,\n            commits: Vec::new(),\n        };\n        let mut branches = Vec::new();\n        walk(child, &children, &mut section, &mut branches);\n        sections.push(section);\n        sections.extend(branches);\n    }\n    let mut ref_points = scope.clone();\n    ref_points.push(onto);\n    ref_points.extend(sections.iter().map(|section| section.parent));\n    ref_points.sort_unstable();","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/todo.rs#L124-L160","documentation":"While building the rebase todo, `prepare` validates that every editable commit's parent is either the selected base itself or another commit already in the processing scope. A commit whose parent lies outside both sets is disconnected from the base — its position in the todo cannot be derived — so preparation aborts.","triggerScenarios":"Calling `prepare` (or `prepare_test`) with a commit range/scope where one of the editable commits has a parent commit that is neither `base` nor a member of the scope set — e.g. the scope includes a commit whose ancestry skips over the base or contains a merge with an out-of-scope parent.","commonSituations":"Hand-picking a set of commits that isn't a contiguous chain from the base; scope computed from a stale object list after history changed; including a merge commit's second parent's side without including it.","solutions":["Include the missing parent commit in the scope so the chain from base to each editable commit is complete.","Select a different base that is the actual (first-parent) ancestor of all editable commits.","Recompute the scope from `base..tip` (e.g. `git rev-list base..tip`) instead of a hand-built list.","Exclude the disconnected commit from the editable set."],"exampleFix":"// before: scope misses an intermediate commit\nlet scope = vec![c3]; // c3's parent c2 not included, not base\nprepare(repo, base, scope)?; // bails\n\n// after\nlet scope = vec![c2, c3]; // contiguous chain from base\nprepare(repo, base, scope)?;","handlingStrategy":"validation","validationCode":"// every editable commit's parent must be base or in scope\nfor id in &scope {\n    let commit = repo.find_commit(id)?.decode()?;\n    let parent = commit.parents.first().expect(\"commit has parent\");\n    if *parent != base && !scope.contains(parent) {\n        anyhow::bail!(\"commit {id} is disconnected from base\");\n    }\n}","typeGuard":null,"tryCatchPattern":"match prepare(repo, base, scope) {\n    Ok(todo) => /* proceed */,\n    Err(e) if e.to_string().contains(\"not connected to the selected base\") => {\n        // rebuild scope from `base..tip` and retry\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Derive scope with `git rev-list base..tip` instead of hand-built lists","Ensure each editable commit's first-parent chain reaches the base","Exclude merge commits or include all their in-scope parents","Recompute scope after any history rewrite"],"tags":["git","rebase","scope","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}