1- using System . ComponentModel . DataAnnotations ;
1+ using System ;
2+ using System . ComponentModel . DataAnnotations ;
23using System . IO ;
34using System . Threading . Tasks ;
4- using Avalonia . Threading ;
55
66namespace SourceGit . ViewModels
77{
@@ -45,6 +45,12 @@ public string SSHKey
4545 set => SetProperty ( ref _sshkey , value , true ) ;
4646 }
4747
48+ public bool PruneTagsOnFetch
49+ {
50+ get ;
51+ set ;
52+ }
53+
4854 public EditRemote ( Repository repo , Models . Remote remote )
4955 {
5056 _repo = repo ;
@@ -53,17 +59,11 @@ public EditRemote(Repository repo, Models.Remote remote)
5359 _url = remote . URL ;
5460 _useSSH = Models . Remote . IsSSH ( remote . URL ) ;
5561
62+ var config = new Commands . Config ( repo . FullPath ) ;
5663 if ( _useSSH )
57- {
58- Task . Run ( async ( ) =>
59- {
60- var sshKey = await new Commands . Config ( repo . FullPath )
61- . GetAsync ( $ "remote.{ remote . Name } .sshkey")
62- . ConfigureAwait ( false ) ;
64+ _sshkey = config . Get ( $ "remote.{ remote . Name } .sshkey") ;
6365
64- Dispatcher . UIThread . Post ( ( ) => SSHKey = sshKey ) ;
65- } ) ;
66- }
66+ PruneTagsOnFetch = config . Get ( $ "remote.{ remote . Name } .pruneTags") . Equals ( "true" , StringComparison . OrdinalIgnoreCase ) ;
6767 }
6868
6969 public static ValidationResult ValidateRemoteName ( string name , ValidationContext ctx )
@@ -131,7 +131,9 @@ public override async Task<bool> Sure()
131131 if ( pushURL != _url )
132132 await new Commands . Remote ( _repo . FullPath ) . SetURLAsync ( _name , _url , true ) ;
133133
134- await new Commands . Config ( _repo . FullPath ) . SetAsync ( $ "remote.{ _name } .sshkey", _useSSH ? SSHKey : null ) ;
134+ var config = new Commands . Config ( _repo . FullPath ) ;
135+ await config . SetAsync ( $ "remote.{ _name } .sshkey", _useSSH ? SSHKey : null ) ;
136+ await config . SetAsync ( $ "remote.{ _name } .pruneTags", PruneTagsOnFetch ? "true" : null ) ;
135137
136138 _repo . SetWatcherEnabled ( true ) ;
137139 return true ;
0 commit comments