1
- using System . ComponentModel . DataAnnotations ;
1
+ using System ;
2
+ using System . ComponentModel . DataAnnotations ;
2
3
using System . IO ;
3
4
using System . Threading . Tasks ;
4
- using Avalonia . Threading ;
5
5
6
6
namespace SourceGit . ViewModels
7
7
{
@@ -45,6 +45,12 @@ public string SSHKey
45
45
set => SetProperty ( ref _sshkey , value , true ) ;
46
46
}
47
47
48
+ public bool PruneTagsOnFetch
49
+ {
50
+ get ;
51
+ set ;
52
+ }
53
+
48
54
public EditRemote ( Repository repo , Models . Remote remote )
49
55
{
50
56
_repo = repo ;
@@ -53,17 +59,11 @@ public EditRemote(Repository repo, Models.Remote remote)
53
59
_url = remote . URL ;
54
60
_useSSH = Models . Remote . IsSSH ( remote . URL ) ;
55
61
62
+ var config = new Commands . Config ( repo . FullPath ) ;
56
63
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") ;
63
65
64
- Dispatcher . UIThread . Post ( ( ) => SSHKey = sshKey ) ;
65
- } ) ;
66
- }
66
+ PruneTagsOnFetch = config . Get ( $ "remote.{ remote . Name } .pruneTags") . Equals ( "true" , StringComparison . OrdinalIgnoreCase ) ;
67
67
}
68
68
69
69
public static ValidationResult ValidateRemoteName ( string name , ValidationContext ctx )
@@ -131,7 +131,9 @@ public override async Task<bool> Sure()
131
131
if ( pushURL != _url )
132
132
await new Commands . Remote ( _repo . FullPath ) . SetURLAsync ( _name , _url , true ) ;
133
133
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 ) ;
135
137
136
138
_repo . SetWatcherEnabled ( true ) ;
137
139
return true ;
0 commit comments