mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-18 14:31:30 +03:00
Merge pull request #5050 from gitbutlerapp/fix-upstream-integration-when-no-branches
Fix upstream integration when there are no new branches
This commit is contained in:
commit
359ef1e216
@ -326,9 +326,22 @@ pub(crate) fn integrate_upstream(
|
||||
virtual_branches_state.set_branch(branch.clone())?;
|
||||
}
|
||||
|
||||
// Now that we've potentially updated the branch trees, lets checkout
|
||||
// the result of merging them all together.
|
||||
checkout_branch_trees(command_context, permission)?;
|
||||
// checkout_branch_trees won't checkout anything if there are no
|
||||
// applied branches, and returns the current_wd_tree as its result.
|
||||
// This is very sensible, but in this case, we want to checkout the
|
||||
// new target sha.
|
||||
if branches.is_empty() {
|
||||
context
|
||||
.repository
|
||||
.checkout_tree_builder(&context.new_target.tree()?)
|
||||
.force()
|
||||
.remove_untracked()
|
||||
.checkout()?;
|
||||
} else {
|
||||
// Now that we've potentially updated the branch trees, lets checkout
|
||||
// the result of merging them all together.
|
||||
checkout_branch_trees(command_context, permission)?;
|
||||
}
|
||||
|
||||
virtual_branches_state.set_default_target(Target {
|
||||
sha: context.new_target.id(),
|
||||
|
Loading…
Reference in New Issue
Block a user