Skip to content

Commit fc5e43c

Browse files
authored
Merge pull request #5733 from gitbutlerapp/update-heads-inserting-commit
fix: update branch heads when inserting above head commit
2 parents 0a51033 + 78fb619 commit fc5e43c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/gitbutler-branch-actions/src/virtual.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,12 @@ pub(crate) fn insert_blank_commit(
15091509
}
15101510
}
15111511
}
1512+
// when inserting a commit above (offeset = -1), it is possible that the new commit is above the branch head
1513+
// so in this case we need to update the heads
1514+
if offset < 0 {
1515+
let new_commit = repository.find_commit(blank_commit_oid)?;
1516+
stack.replace_head(ctx, &commit, &new_commit)?
1517+
}
15121518

15131519
Ok(())
15141520
}

0 commit comments

Comments
 (0)