@@ -13,7 +13,10 @@ use anyhow::Result;
13
13
use asyncgit:: {
14
14
asyncjob:: AsyncSingleJob ,
15
15
remote_tags:: AsyncRemoteTagsJob ,
16
- sync:: cred:: { extract_username_password, need_username_password} ,
16
+ sync:: cred:: {
17
+ extract_username_password, need_username_password,
18
+ BasicAuthCredential ,
19
+ } ,
17
20
sync:: { get_tags_with_metadata, TagWithMetadata } ,
18
21
AsyncGitNotification , CWD ,
19
22
} ;
@@ -41,6 +44,7 @@ pub struct TagListComponent {
41
44
table_state : std:: cell:: Cell < TableState > ,
42
45
current_height : std:: cell:: Cell < usize > ,
43
46
missing_remote_tags : Option < Vec < String > > ,
47
+ basic_credential : Option < BasicAuthCredential > ,
44
48
async_remote_tags :
45
49
AsyncSingleJob < AsyncRemoteTagsJob , AsyncGitNotification > ,
46
50
key_config : SharedKeyConfig ,
@@ -161,6 +165,11 @@ impl Component for TagListComponent {
161
165
self . valid_selection ( ) ,
162
166
true ,
163
167
) ) ;
168
+ out. push ( CommandInfo :: new (
169
+ strings:: commands:: push_tags ( & self . key_config ) ,
170
+ true ,
171
+ true ,
172
+ ) ) ;
164
173
}
165
174
visibility_blocking ( self )
166
175
}
@@ -212,6 +221,8 @@ impl Component for TagListComponent {
212
221
Ok ( EventState :: Consumed )
213
222
} ,
214
223
) ;
224
+ } else if key == self . key_config . push {
225
+ self . queue . push ( InternalEvent :: PushTags ) ;
215
226
}
216
227
}
217
228
@@ -250,6 +261,7 @@ impl TagListComponent {
250
261
visible : false ,
251
262
table_state : std:: cell:: Cell :: new ( TableState :: default ( ) ) ,
252
263
current_height : std:: cell:: Cell :: new ( 0 ) ,
264
+ basic_credential : None ,
253
265
missing_remote_tags : None ,
254
266
async_remote_tags : AsyncSingleJob :: new (
255
267
sender. clone ( ) ,
@@ -264,8 +276,6 @@ impl TagListComponent {
264
276
self . table_state . get_mut ( ) . select ( Some ( 0 ) ) ;
265
277
self . show ( ) ?;
266
278
267
- self . update_tags ( ) ?;
268
-
269
279
let basic_credential = if need_username_password ( ) ? {
270
280
let credential = extract_username_password ( ) ?;
271
281
@@ -278,8 +288,10 @@ impl TagListComponent {
278
288
None
279
289
} ;
280
290
281
- self . async_remote_tags
282
- . spawn ( AsyncRemoteTagsJob :: new ( basic_credential) ) ;
291
+ self . basic_credential = basic_credential;
292
+
293
+ self . update_tags ( ) ?;
294
+ self . update_missing_remote_tags ( ) ;
283
295
284
296
Ok ( ( ) )
285
297
}
@@ -293,6 +305,8 @@ impl TagListComponent {
293
305
Some ( missing_remote_tags) ;
294
306
}
295
307
}
308
+ } else if event == AsyncGitNotification :: PushTags {
309
+ self . update_missing_remote_tags ( ) ;
296
310
}
297
311
}
298
312
@@ -310,6 +324,12 @@ impl TagListComponent {
310
324
Ok ( ( ) )
311
325
}
312
326
327
+ pub fn update_missing_remote_tags ( & mut self ) {
328
+ self . async_remote_tags . spawn ( AsyncRemoteTagsJob :: new (
329
+ self . basic_credential . clone ( ) ,
330
+ ) ) ;
331
+ }
332
+
313
333
///
314
334
fn move_selection ( & mut self , scroll_type : ScrollType ) -> bool {
315
335
let mut table_state = self . table_state . take ( ) ;
0 commit comments