@@ -15,14 +15,13 @@ use crate::{
15
15
} ;
16
16
use anyhow:: Result ;
17
17
use asyncgit:: {
18
- asyncjob:: AsyncSingleJob ,
19
18
cached,
20
19
sync:: {
21
20
self , status:: StatusType , RepoPath , RepoPathRef , RepoState ,
22
21
} ,
23
22
sync:: { BranchCompare , CommitId } ,
24
- AsyncBranchesJob , AsyncDiff , AsyncGitNotification , AsyncStatus ,
25
- DiffParams , DiffType , PushType , StatusItem , StatusParams ,
23
+ AsyncDiff , AsyncGitNotification , AsyncStatus , DiffParams ,
24
+ DiffType , PushType , StatusItem , StatusParams ,
26
25
} ;
27
26
28
27
use crossterm:: event:: Event ;
@@ -74,7 +73,6 @@ pub struct Status {
74
73
git_status_stage : AsyncStatus ,
75
74
git_branch_state : Option < BranchCompare > ,
76
75
git_branch_name : cached:: BranchName ,
77
- git_branches : AsyncSingleJob < AsyncBranchesJob > ,
78
76
queue : Queue ,
79
77
git_action_executed : bool ,
80
78
options : SharedOptions ,
@@ -187,7 +185,6 @@ impl Status {
187
185
repo_clone,
188
186
env. sender_git . clone ( ) ,
189
187
) ,
190
- git_branches : AsyncSingleJob :: new ( env. sender_git . clone ( ) ) ,
191
188
git_action_executed : false ,
192
189
git_branch_state : None ,
193
190
git_branch_name : cached:: BranchName :: new (
@@ -408,22 +405,12 @@ impl Status {
408
405
self . git_diff . is_pending ( )
409
406
|| self . git_status_stage . is_pending ( )
410
407
|| self . git_status_workdir . is_pending ( )
411
- || self . git_branches . is_pending ( )
412
408
}
413
409
414
410
fn check_remotes ( & mut self ) {
415
- self . has_remotes = false ;
416
-
417
- if let Some ( result) = self . git_branches . take_last ( ) {
418
- if let Some ( Ok ( branches) ) = result. result ( ) {
419
- self . has_remotes = !branches. is_empty ( ) ;
420
- }
421
- } else {
422
- self . git_branches . spawn ( AsyncBranchesJob :: new (
423
- self . repo . borrow ( ) . clone ( ) ,
424
- false ,
425
- ) ) ;
426
- }
411
+ self . has_remotes =
412
+ sync:: get_default_remote ( & self . repo . borrow ( ) . clone ( ) )
413
+ . is_ok ( ) ;
427
414
}
428
415
429
416
///
@@ -609,10 +596,12 @@ impl Status {
609
596
}
610
597
611
598
fn can_push ( & self ) -> bool {
612
- self . git_branch_state
599
+ let is_ahead = self
600
+ . git_branch_state
613
601
. as_ref ( )
614
- . map_or ( true , |state| state. ahead > 0 )
615
- && self . has_remotes
602
+ . map_or ( true , |state| state. ahead > 0 ) ;
603
+
604
+ is_ahead && self . has_remotes
616
605
}
617
606
618
607
const fn can_pull ( & self ) -> bool {
0 commit comments