Skip to content

Commit ac2f652

Browse files
author
Stephan Dilly
committed
check if we can_push before trying (#533)
closes #531
1 parent 9e55f95 commit ac2f652

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Diff for: src/tabs/status.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -376,17 +376,19 @@ impl Status {
376376
}
377377

378378
fn push(&self, force: bool) {
379-
if let Some(branch) = self.git_branch_name.last() {
380-
if force {
381-
self.queue.borrow_mut().push_back(
382-
InternalEvent::ConfirmAction(Action::ForcePush(
383-
branch, force,
384-
)),
385-
);
386-
} else {
387-
self.queue
388-
.borrow_mut()
389-
.push_back(InternalEvent::Push(branch, force));
379+
if self.can_push() {
380+
if let Some(branch) = self.git_branch_name.last() {
381+
if force {
382+
self.queue.borrow_mut().push_back(
383+
InternalEvent::ConfirmAction(
384+
Action::ForcePush(branch, force),
385+
),
386+
);
387+
} else {
388+
self.queue.borrow_mut().push_back(
389+
InternalEvent::Push(branch, force),
390+
);
391+
}
390392
}
391393
}
392394
}

0 commit comments

Comments
 (0)