{"record":{"id":"cb5a34baa79a0ded","repo":"GitoxideLabs/gitoxide","slug":"cannot-spill-an-unmerged-path","errorCode":null,"errorMessage":"cannot spill an unmerged path","messagePattern":"cannot spill an unmerged path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/head.rs","lineNumber":282,"sourceCode":"            ChangeKind::Added => {\n                editor.remove(&change.path).context(\"could not spill the added path\")?;\n            }\n            ChangeKind::Deleted | ChangeKind::Modified | ChangeKind::TypeChanged => {\n                restore_path(&parent, &mut editor, &change.path)?;\n            }\n            ChangeKind::Renamed | ChangeKind::Copied => {\n                editor\n                    .remove(&change.path)\n                    .context(\"could not spill the rewritten destination\")?;\n                if change.kind == ChangeKind::Renamed {\n                    restore_path(\n                        &parent,\n                        &mut editor,\n                        change.source.as_ref().context(\"a rename has no source path\")?,\n                    )?;\n                }\n            }\n            ChangeKind::Unmerged => anyhow::bail!(\"cannot spill an unmerged path\"),\n        }\n    }\n    Ok(editor\n        .write()\n        .context(\"could not build the partially spilled tree\")?\n        .detach())\n}\n\nfn restore_path(\n    parent: &gix::Tree<'_>,\n    editor: &mut gix::object::tree::Editor<'_>,\n    path: &gix::bstr::BString,\n) -> Result<()> {\n    let entry = parent\n        .lookup_entry(\n            path.split(|byte| *byte == b'/')\n                .map(|component| BStr::new(component).to_owned()),\n        )","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/head.rs#L264-L300","documentation":"`spill_paths_tree` rebuilds a tree that undoes selected path changes from a commit, but an `Unmerged` path change (a merge conflict with multiple index stages) has no single well-defined content to restore. The library bails out instead of guessing which stage to spill. Resolve the conflict first so the path has a definite entry.","triggerScenarios":"Spilling changes off a commit when the commit's diff contains an entry whose `ChangeKind` is `Unmerged` — typically a commit created from an index that still contains conflict stages, or a conflict recorded in history comparisons.","commonSituations":"A commit was made while the index still held unmerged stages (e.g. via `git commit -a` after a conflicted merge with unresolved entries forced through), and the user later tries to spill/revert those paths in tix.","solutions":["Resolve the conflicted path in the worktree/index and create a new commit containing the resolution, then retry the spill.","Abort the operation and clean the conflict state with `git status`/`git restore --staged` before re-running tix.","Check the source commit for conflict markers or unmerged entries (`git ls-files -u`) before spilling."],"exampleFix":"// before: spilling a commit built on an unmerged index\n// error: cannot spill an unmerged path\n\n// after: resolve first\ngit checkout --theirs path && git add path && git commit -m \"resolve\"\n# then retry the tix spill","handlingStrategy":"validation","validationCode":"// Rust: skip or reject unmerged changes before spilling\nif changes.iter().any(|c| c.kind == ChangeKind::Unmerged) {\n    anyhow::bail!(\"resolve conflicts before spilling\");\n}","typeGuard":"fn spillable(c: &PathChange) -> bool {\n    c.kind != ChangeKind::Unmerged\n}","tryCatchPattern":null,"preventionTips":["Never commit while the index has unmerged stages (`git ls-files -u` should be empty).","Resolve conflicts and re-commit before running spill operations."],"tags":["git","merge-conflict","index","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}