mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-30 01:17:37 +03:00
Merge pull request #2055 from gitbutlerapp/update-projects-and-apply-branch
Update projects and apply branch
This commit is contained in:
commit
cede6734b0
@ -288,9 +288,10 @@ pub fn apply_branch(
|
||||
.find_tree(merged_branch_tree_oid)
|
||||
.context("failed to find tree")?;
|
||||
|
||||
if branch.upstream.is_some() {
|
||||
// branch was pushed to upstream. create a merge commit to avoid need
|
||||
// of force pushing.
|
||||
let ok_with_force_push = project_repository.project().ok_with_force_push;
|
||||
if branch.upstream.is_some() && !ok_with_force_push {
|
||||
// branch was pushed to upstream, and user doesn't like force pushing.
|
||||
// create a merge commit to avoid the need of force pushing then.
|
||||
|
||||
let new_branch_head = project_repository.commit(
|
||||
user,
|
||||
|
@ -2613,9 +2613,19 @@ mod update_base_branch {
|
||||
repository,
|
||||
project_id,
|
||||
controller,
|
||||
projects,
|
||||
..
|
||||
} = Test::default();
|
||||
|
||||
projects
|
||||
.update(&projects::UpdateRequest {
|
||||
id: project_id,
|
||||
ok_with_force_push: Some(false),
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.set_base_branch(&project_id, &"refs/remotes/origin/master".parse().unwrap())
|
||||
.await
|
||||
@ -3659,6 +3669,15 @@ mod amend {
|
||||
..
|
||||
} = Test::default();
|
||||
|
||||
projects
|
||||
.update(&projects::UpdateRequest {
|
||||
id: project_id,
|
||||
ok_with_force_push: Some(false),
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
controller
|
||||
.set_base_branch(&project_id, &"refs/remotes/origin/master".parse().unwrap())
|
||||
.await
|
||||
|
Loading…
Reference in New Issue
Block a user