{"record":{"id":"4e15e1ec993ae6db","repo":"GitoxideLabs/gitoxide","slug":"review-commits-can-amend-only-staged-paths","errorCode":null,"errorMessage":"review commits can amend only staged paths","messagePattern":"review commits can amend only staged paths","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/head.rs","lineNumber":110,"sourceCode":"    let tree = match kind {\n        Kind::Spill => match selected_paths {\n            Some((paths, selected_parent)) => {\n                spill_paths_tree(&repo, old_tree, selected_parent.unwrap_or(parent_tree), paths)?\n            }\n            None => parent_tree,\n        },\n        Kind::Amend => {\n            let index = repo.index_or_empty().context(\"could not load the index\")?;\n            if index\n                .entries()\n                .iter()\n                .any(|entry| entry.stage() != gix::index::entry::Stage::Unconflicted)\n            {\n                anyhow::bail!(\"cannot amend with unresolved index conflicts\");\n            }\n            if let Some(path) = selected_amend_path {\n                if review && path.group != crate::ChangeGroup::Staged {\n                    anyhow::bail!(\"review commits can amend only staged paths\");\n                }\n                amend_path_tree(&repo, old_tree, path, &index)?\n            } else if review || index_only {\n                let index_tree = create::index_tree(&repo, &index)?;\n                if index_tree == old_tree && !pending {\n                    return Ok(None);\n                }\n                index_tree\n            } else {\n                let index_tree = create::index_tree(&repo, &index)?;\n                if index_tree != old_tree {\n                    index_tree\n                } else {\n                    let baseline = repo.find_tree(old_tree)?;\n                    create::worktree_tree(&repo, &baseline)?\n                }\n            }\n        }","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/head.rs#L92-L128","documentation":"In review mode, amending is restricted to paths in the `ChangeGroup::Staged` group. If a review-driven amend selects a path whose group is anything else (unstaged/other), the operation is refused because review commits only incorporate staged changes.","triggerScenarios":"`perform_inner` with the `review` flag set, `Kind::Amend`, and `selected_amend_path` whose `path.group != crate::ChangeGroup::Staged` — e.g. selecting an unstaged path for amend while in review flow.","commonSituations":"Using review-mode commands while an unstaged path is selected; UI state keeping a previously-unstaged path selected; scripts passing review:true with arbitrary path groups.","solutions":["Stage the selected path first so its group is `ChangeGroup::Staged`, then amend in review mode.","Select only staged paths when amending under review mode.","Run the amend without review mode if amending non-staged paths is intended."],"exampleFix":"// before: amending an unstaged path in review mode\n// after\nrepo.stage_paths([&selected_path])?; // or the tix staging equivalent\nhead::perform(&repo, Kind::Amend, Some((&[selected_path], ChangeGroup::Staged)), ...)?;","handlingStrategy":"validation","validationCode":"if review && let Some(path) = selected_amend_path {\n    if path.group != crate::ChangeGroup::Staged {\n        anyhow::bail!(\"stage the path or disable review mode before amending\");\n    }\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"review commits can amend only staged paths\") => {\n        eprintln!(\"stage the selected path or run without review mode\");\n    }\n    other => other?,\n}","preventionTips":["Stage paths before selecting them for review-mode amend.","Only pass `review: true` when the selection is guaranteed staged.","Map path groups in the UI so unstaged paths cannot be chosen in review flows."],"tags":["git","amend","review"],"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"}