@@ -966,17 +966,14 @@ impl App {
966
966
Ok ( flags)
967
967
}
968
968
969
- #[ allow( clippy:: too_many_lines) ]
970
969
fn process_confirmed_action (
971
970
& mut self ,
972
971
action : Action ,
973
972
flags : & mut NeedsUpdate ,
974
973
) -> Result < ( ) > {
975
974
match action {
976
975
Action :: Reset ( r) => {
977
- if self . status_tab . reset ( & r) {
978
- flags. insert ( NeedsUpdate :: ALL ) ;
979
- }
976
+ self . status_tab . reset ( & r) ;
980
977
}
981
978
Action :: StashDrop ( _) | Action :: StashPop ( _) => {
982
979
if let Err ( e) = self
@@ -987,8 +984,6 @@ impl App {
987
984
e. to_string ( ) ,
988
985
) ) ;
989
986
}
990
-
991
- flags. insert ( NeedsUpdate :: ALL ) ;
992
987
}
993
988
Action :: ResetHunk ( path, hash) => {
994
989
sync:: reset_hunk (
@@ -997,15 +992,13 @@ impl App {
997
992
hash,
998
993
Some ( self . options . borrow ( ) . diff_options ( ) ) ,
999
994
) ?;
1000
- flags. insert ( NeedsUpdate :: ALL ) ;
1001
995
}
1002
996
Action :: ResetLines ( path, lines) => {
1003
997
sync:: discard_lines (
1004
998
& self . repo . borrow ( ) ,
1005
999
& path,
1006
1000
& lines,
1007
1001
) ?;
1008
- flags. insert ( NeedsUpdate :: ALL ) ;
1009
1002
}
1010
1003
Action :: DeleteLocalBranch ( branch_ref) => {
1011
1004
if let Err ( e) = sync:: delete_branch (
@@ -1016,50 +1009,14 @@ impl App {
1016
1009
e. to_string ( ) ,
1017
1010
) ) ;
1018
1011
}
1019
- flags . insert ( NeedsUpdate :: ALL ) ;
1012
+
1020
1013
self . select_branch_popup . update_branches ( ) ?;
1021
1014
}
1022
1015
Action :: DeleteRemoteBranch ( branch_ref) => {
1023
- self . queue . push (
1024
- //TODO: check if this is correct based on the fix in `c6abbaf`
1025
- branch_ref. rsplit ( '/' ) . next ( ) . map_or_else (
1026
- || {
1027
- InternalEvent :: ShowErrorMsg ( format ! (
1028
- "Failed to find the branch name in {branch_ref}"
1029
- ) )
1030
- } ,
1031
- |name| {
1032
- InternalEvent :: Push (
1033
- name. to_string ( ) ,
1034
- PushType :: Branch ,
1035
- false ,
1036
- true ,
1037
- )
1038
- } ,
1039
- ) ,
1040
- ) ;
1041
- flags. insert ( NeedsUpdate :: ALL ) ;
1042
- self . select_branch_popup . update_branches ( ) ?;
1016
+ self . delete_remote_branch ( & branch_ref) ?;
1043
1017
}
1044
1018
Action :: DeleteTag ( tag_name) => {
1045
- if let Err ( error) =
1046
- sync:: delete_tag ( & self . repo . borrow ( ) , & tag_name)
1047
- {
1048
- self . queue . push ( InternalEvent :: ShowErrorMsg (
1049
- error. to_string ( ) ,
1050
- ) ) ;
1051
- } else {
1052
- let remote = sync:: get_default_remote (
1053
- & self . repo . borrow ( ) ,
1054
- ) ?;
1055
-
1056
- self . queue . push ( InternalEvent :: ConfirmAction (
1057
- Action :: DeleteRemoteTag ( tag_name, remote) ,
1058
- ) ) ;
1059
-
1060
- flags. insert ( NeedsUpdate :: ALL ) ;
1061
- self . tags_popup . update_tags ( ) ?;
1062
- }
1019
+ self . delete_tag ( tag_name) ?;
1063
1020
}
1064
1021
Action :: DeleteRemoteTag ( tag_name, _remote) => {
1065
1022
self . queue . push ( InternalEvent :: Push (
@@ -1079,18 +1036,64 @@ impl App {
1079
1036
}
1080
1037
Action :: PullMerge { rebase, .. } => {
1081
1038
self . pull_popup . try_conflict_free_merge ( rebase) ;
1082
- flags. insert ( NeedsUpdate :: ALL ) ;
1083
1039
}
1084
1040
Action :: AbortRevert | Action :: AbortMerge => {
1085
1041
self . status_tab . revert_pending_state ( ) ;
1086
- flags. insert ( NeedsUpdate :: ALL ) ;
1087
1042
}
1088
1043
Action :: AbortRebase => {
1089
1044
self . status_tab . abort_rebase ( ) ;
1090
- flags. insert ( NeedsUpdate :: ALL ) ;
1091
1045
}
1092
1046
} ;
1093
1047
1048
+ flags. insert ( NeedsUpdate :: ALL ) ;
1049
+
1050
+ Ok ( ( ) )
1051
+ }
1052
+
1053
+ fn delete_tag ( & mut self , tag_name : String ) -> Result < ( ) > {
1054
+ if let Err ( error) =
1055
+ sync:: delete_tag ( & self . repo . borrow ( ) , & tag_name)
1056
+ {
1057
+ self . queue
1058
+ . push ( InternalEvent :: ShowErrorMsg ( error. to_string ( ) ) ) ;
1059
+ } else {
1060
+ let remote =
1061
+ sync:: get_default_remote ( & self . repo . borrow ( ) ) ?;
1062
+
1063
+ self . queue . push ( InternalEvent :: ConfirmAction (
1064
+ Action :: DeleteRemoteTag ( tag_name, remote) ,
1065
+ ) ) ;
1066
+
1067
+ self . tags_popup . update_tags ( ) ?;
1068
+ } ;
1069
+ Ok ( ( ) )
1070
+ }
1071
+
1072
+ fn delete_remote_branch (
1073
+ & mut self ,
1074
+ branch_ref : & str ,
1075
+ ) -> Result < ( ) > {
1076
+ self . queue . push (
1077
+ //TODO: check if this is correct based on the fix in `c6abbaf`
1078
+ branch_ref. rsplit ( '/' ) . next ( ) . map_or_else (
1079
+ || {
1080
+ InternalEvent :: ShowErrorMsg ( format ! (
1081
+ "Failed to find the branch name in {branch_ref}"
1082
+ ) )
1083
+ } ,
1084
+ |name| {
1085
+ InternalEvent :: Push (
1086
+ name. to_string ( ) ,
1087
+ PushType :: Branch ,
1088
+ false ,
1089
+ true ,
1090
+ )
1091
+ } ,
1092
+ ) ,
1093
+ ) ;
1094
+
1095
+ self . select_branch_popup . update_branches ( ) ?;
1096
+
1094
1097
Ok ( ( ) )
1095
1098
}
1096
1099
0 commit comments