Skip to content
8 changes: 6 additions & 2 deletions git-branchless-lib/src/core/rewrite/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,9 @@ impl<'a> RebasePlanBuilder<'a> {
source_oid: NonZeroOid,
dest_oids: Vec<NonZeroOid>,
) -> eyre::Result<()> {
assert!(!dest_oids.is_empty());
if dest_oids.is_empty() {
eyre::bail!("Destination OIDs must not be empty for move_subtree");
}
Comment on lines +1026 to +1028
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this change even though it was preexisting! 😄

self.initial_constraints.push(Constraint::MoveSubtree {
parent_oids: dest_oids,
child_oid: source_oid,
Expand Down Expand Up @@ -1087,7 +1089,9 @@ impl<'a> RebasePlanBuilder<'a> {
parent_oids: Vec<NonZeroOid>,
repo: &Repo,
) -> eyre::Result<()> {
assert!(!parent_oids.is_empty());
if parent_oids.is_empty() {
eyre::bail!("Parent OIDs must not be empty for reparent_subtree");
}

// To keep the contents of all descendant commits the same, forcibly
// replace the children commits, and then rely on normal patch
Expand Down