check if we can_push before trying (#533)

closes #531
This commit is contained in:
Stephan Dilly 2021-02-23 12:32:32 +01:00 committed by GitHub
parent cc9ecb34a2
commit 5244751e9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -376,17 +376,19 @@ impl Status {
}
fn push(&self, force: bool) {
if let Some(branch) = self.git_branch_name.last() {
if force {
self.queue.borrow_mut().push_back(
InternalEvent::ConfirmAction(Action::ForcePush(
branch, force,
)),
);
} else {
self.queue
.borrow_mut()
.push_back(InternalEvent::Push(branch, force));
if self.can_push() {
if let Some(branch) = self.git_branch_name.last() {
if force {
self.queue.borrow_mut().push_back(
InternalEvent::ConfirmAction(
Action::ForcePush(branch, force),
),
);
} else {
self.queue.borrow_mut().push_back(
InternalEvent::Push(branch, force),
);
}
}
}
}