Skip to content

Commit f335d2d

Browse files
committed
Fix a bug where updating the workspace could remove uncommitted changes
1 parent 4b65483 commit f335d2d

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,6 @@ pub(crate) fn integrate_upstream(
503503
continue;
504504
};
505505

506-
stack.set_stack_head(command_context, *head, Some(*tree))?;
507-
508506
// Update the branch heads
509507
if let Some(output) = rebase_output {
510508
let mut new_heads: HashMap<String, git2::Commit<'_>> = HashMap::new();
@@ -516,6 +514,7 @@ pub(crate) fn integrate_upstream(
516514
}
517515
stack.set_all_heads(command_context, new_heads)?;
518516
}
517+
stack.set_stack_head(command_context, *head, Some(*tree))?;
519518

520519
let mut archived_branches =
521520
stack.archive_integrated_heads(command_context, for_archival)?;

crates/gitbutler-stack/src/stack.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,12 +695,9 @@ impl Stack {
695695
{
696696
return Err(anyhow!("The new head names do not match the current heads"));
697697
}
698-
let stack_head = self.head();
699698
let gix_repo = ctx.gix_repository()?;
700699
for head in &mut self.heads {
701700
if let Some(commit) = new_heads.get(head.name()) {
702-
let new_head = commit.clone().into();
703-
validate_target(&new_head, ctx.repo(), stack_head, &state)?;
704701
head.set_head(commit.clone().into(), &gix_repo)?;
705702
}
706703
}

0 commit comments

Comments
 (0)