mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-29 12:33:49 +03:00
Always create new commit in get_workspace_head
- so we can safely recreate the integration commit
This commit is contained in:
parent
11f0063f18
commit
b676115b11
@ -38,20 +38,9 @@ pub(crate) fn get_workspace_head(ctx: &CommandContext) -> Result<git2::Oid> {
|
||||
|
||||
let mut virtual_branches: Vec<Branch> = vb_state.list_branches_in_workspace()?;
|
||||
|
||||
let branch_heads = virtual_branches
|
||||
.iter()
|
||||
.map(|b| repo.find_commit(b.head))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
let branch_head_refs = branch_heads.iter().collect::<Vec<_>>();
|
||||
|
||||
let target_commit = repo.find_commit(target.sha)?;
|
||||
let mut workspace_tree = target_commit.tree()?;
|
||||
|
||||
// If no branches are applied then the workspace head is the target.
|
||||
if branch_head_refs.is_empty() {
|
||||
return Ok(target_commit.id());
|
||||
}
|
||||
|
||||
if conflicts::is_conflicting(ctx, None)? {
|
||||
let merge_parent = conflicts::merge_parent(ctx)?.ok_or(anyhow!("No merge parent"))?;
|
||||
let first_branch = virtual_branches.first().ok_or(anyhow!("No branches"))?;
|
||||
@ -215,13 +204,8 @@ pub fn update_gitbutler_integration(
|
||||
// It would be nice if we could pass an `update_ref` parameter to this function, but that
|
||||
// requires committing to the tip of the branch, and we're mostly replacing the tip.
|
||||
|
||||
let workspace_head_parents = workspace_head.parents().collect::<Vec<_>>();
|
||||
let parents = workspace_head.parents().collect::<Vec<_>>();
|
||||
let workspace_tree = workspace_head.tree()?;
|
||||
let parents = if workspace_head_parents.len() > 1 {
|
||||
workspace_head_parents
|
||||
} else {
|
||||
vec![workspace_head]
|
||||
};
|
||||
|
||||
let final_commit = repo.commit(
|
||||
None,
|
||||
|
Loading…
Reference in New Issue
Block a user