File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,17 @@ public bool Prune(string name)
3232 return Exec ( ) ;
3333 }
3434
35- public bool SetURL ( string name , string url )
35+ public string GetURL ( string name , bool isPush )
3636 {
37- Args = $ "remote set-url { name } { url } ";
37+ Args = "remote get-url" + ( isPush ? " --push " : " " ) + name ;
38+
39+ var rs = ReadToEnd ( ) ;
40+ return rs . IsSuccess ? rs . StdOut . Trim ( ) : string . Empty ;
41+ }
42+
43+ public bool SetURL ( string name , string url , bool isPush )
44+ {
45+ Args = "remote set-url" + ( isPush ? " --push " : " " ) + $ "{ name } { url } ";
3846 return Exec ( ) ;
3947 }
4048 }
Original file line number Diff line number Diff line change @@ -118,11 +118,15 @@ public override Task<bool> Sure()
118118
119119 if ( _remote . URL != _url )
120120 {
121- var succ = new Commands . Remote ( _repo . FullPath ) . SetURL ( _name , _url ) ;
121+ var succ = new Commands . Remote ( _repo . FullPath ) . SetURL ( _name , _url , false ) ;
122122 if ( succ )
123123 _remote . URL = _url ;
124124 }
125125
126+ var pushURL = new Commands . Remote ( _repo . FullPath ) . GetURL ( _name , true ) ;
127+ if ( pushURL != _url )
128+ new Commands . Remote ( _repo . FullPath ) . SetURL ( _name , _url , true ) ;
129+
126130 SetProgressDescription ( "Post processing ..." ) ;
127131 new Commands . Config ( _repo . FullPath ) . Set ( $ "remote.{ _name } .sshkey", _useSSH ? SSHKey : null ) ;
128132
You can’t perform that action at this time.
0 commit comments