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) { fn push(&self, force: bool) {
if let Some(branch) = self.git_branch_name.last() { if self.can_push() {
if force { if let Some(branch) = self.git_branch_name.last() {
self.queue.borrow_mut().push_back( if force {
InternalEvent::ConfirmAction(Action::ForcePush( self.queue.borrow_mut().push_back(
branch, force, InternalEvent::ConfirmAction(
)), Action::ForcePush(branch, force),
); ),
} else { );
self.queue } else {
.borrow_mut() self.queue.borrow_mut().push_back(
.push_back(InternalEvent::Push(branch, force)); InternalEvent::Push(branch, force),
);
}
} }
} }
} }