forked from mirrors/jj
cli: on git push, do not ignore conflicting branch at @
If @ is pointed by any branch, we shouldn't fall back to @-.
This commit is contained in:
parent
908520dcf5
commit
a3d080580e
2 changed files with 10 additions and 7 deletions
|
@ -671,7 +671,11 @@ fn cmd_git_push(
|
|||
view.branches()
|
||||
.iter()
|
||||
.filter(|(_, branch_target)| {
|
||||
matches!(&branch_target.local_target, Some(RefTarget::Normal(id)) if is_target(id))
|
||||
if let Some(target) = &branch_target.local_target {
|
||||
target.adds().iter().any(&mut is_target)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
@ -812,10 +816,10 @@ fn cmd_git_push(
|
|||
return Err(user_error("No current branch."));
|
||||
}
|
||||
for (branch_name, branch_target) in branches {
|
||||
if let Ok(Some(update)) =
|
||||
classify_branch_update(branch_name, branch_target, &remote)
|
||||
{
|
||||
branch_updates.push((branch_name.clone(), update));
|
||||
match classify_branch_update(branch_name, branch_target, &remote) {
|
||||
Ok(Some(update)) => branch_updates.push((branch_name.clone(), update)),
|
||||
Ok(None) => {}
|
||||
Err(message) => return Err(user_error(message)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -538,10 +538,9 @@ fn test_git_push_conflicting_branches() {
|
|||
};
|
||||
|
||||
// Conflicting branch at @
|
||||
// TODO: fix error message
|
||||
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]);
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Error: No current branch.
|
||||
Error: Branch branch2 is conflicted
|
||||
"###);
|
||||
|
||||
// --branch should be blocked by conflicting branch
|
||||
|
|
Loading…
Reference in a new issue