GitoxideLabs/gitoxide · error
review commits can amend only staged paths
Error message
review commits can amend only staged paths
What it means
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.
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.
Example fix
// before: amending an unstaged path in review mode // after repo.stage_paths([&selected_path])?; // or the tix staging equivalent head::perform(&repo, Kind::Amend, Some((&[selected_path], ChangeGroup::Staged)), ...)?;
Defensive patterns
Strategy: validation
Validate before calling
if review && let Some(path) = selected_amend_path {
if path.group != crate::ChangeGroup::Staged {
anyhow::bail!("stage the path or disable review mode before amending");
}
} Try / catch
match result {
Err(e) if e.to_string().contains("review commits can amend only staged paths") => {
eprintln!("stage the selected path or run without review mode");
}
other => other?,
} Prevention
- 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.
When it happens
Trigger: `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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- cannot amend with unresolved index conflicts
- a tree change cannot be amended from the worktree
- review commits cannot be copied
- review commit names an invalid review reference
- the review base must be an ancestor of the reviewed commit
AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08).
Data as JSON: /api/errors/4e15e1ec993ae6db.
Report an issue: GitHub.
Appendix: source
Thrown at gix-tix/src/edit/head.rs:110
let tree = match kind {
Kind::Spill => match selected_paths {
Some((paths, selected_parent)) => {
spill_paths_tree(&repo, old_tree, selected_parent.unwrap_or(parent_tree), paths)?
}
None => parent_tree,
},
Kind::Amend => {
let index = repo.index_or_empty().context("could not load the index")?;
if index
.entries()
.iter()
.any(|entry| entry.stage() != gix::index::entry::Stage::Unconflicted)
{
anyhow::bail!("cannot amend with unresolved index conflicts");
}
if let Some(path) = selected_amend_path {
if review && path.group != crate::ChangeGroup::Staged {
anyhow::bail!("review commits can amend only staged paths");
}
amend_path_tree(&repo, old_tree, path, &index)?
} else if review || index_only {
let index_tree = create::index_tree(&repo, &index)?;
if index_tree == old_tree && !pending {
return Ok(None);
}
index_tree
} else {
let index_tree = create::index_tree(&repo, &index)?;
if index_tree != old_tree {
index_tree
} else {
let baseline = repo.find_tree(old_tree)?;
create::worktree_tree(&repo, &baseline)?
}
}
}View on GitHub (pinned to e73179060b)